Subject: | call forks from double test in if statement |
Date: | Tue, 29 Apr 2014 15:44:26 -0400 |
To: | bug-POE [...] rt.cpan.org |
From: | Perry Sebastian <perry.sebastian [...] gmail.com> |
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.