Subject: | Re: call forks from double test in if statement |
Date: | Tue, 29 Apr 2014 16:50:02 -0400 |
To: | bug-POE [...] rt.cpan.org |
From: | Perry Sebastian <perry.sebastian [...] gmail.com> |
A follow up on the previous bug report.
Although the IF statement appeared to generate (and suppress) the double
call to a post session, the double call may be related to Moose-POE
behaviour. It occurred from printing undefined variable values, too.
I am calling POE sessions inside a [moose] object, and using wait (count)
routines defined as object states. An attempt to retrieve a value from the
object hash variable
$_[OBJECT]->{ACTIVE_ALIASES} - using an unset key, also generated a double
call to a post session. Properly setting the hash key, corrected the double
call to one call per loop.
On Tue, Apr 29, 2014 at 3:44 PM, Perry Sebastian
<perry.sebastian@gmail.com>wrote:
Show quoted text
> Hi,
>
> I did not find a mention of this from a google search of POE bugs, so I'm
> assuming that it could be new. I came across an unusual feature/bug in POE.
> This code will generate 2 kernel calls for each loop. Both calls use the
> same hash pointer to the args.
>
> ...
> use Moose;
> use POE;
>
> ...
>
> foreach my $key (keys %$sessions) {
> my $args = $sessions->{$key};
> foreach my $k (keys %$args) {
> print "show me .. k[$k] and v[".$args->{$k}."]\n";
> }
> if(exists $args->{SESSION} and $args->{SESSION}) {
> print "Tracer statement...you are here...\n";
> $_[KERNEL]->post( 'regAlias', 'REGISTER', $args );
> }
> }
>
> Commenting out the if(exist... statement will generate 1 kernel call for
> each loop...which is the expected behavior.
>
>
>