Skip Menu |

This queue is for tickets about the POE CPAN distribution.

Report information
The Basics
Id: 51772
Status: resolved
Priority: 0/
Queue: POE

People
Owner: Nobody in particular
Requestors: dolmen [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 1.006
  • 1.280
Fixed in: (no value)



Subject: _child(lose) event fired for a session detached from its parent
When a session is detached from its parent in its _start event (POE::Kernel->detach_myself), no _child events should be fired to the session which called the POE::Session->create constructor. Currently no _child(create) is fired. This is good. But a _child(lose) is fired. This is unexpected. And inconsistent as we are in a case where we have a _child(lose) without a corresponding _child(create/gain). This bug has been discussed on the mailing list on 2009-11-19. A complete test case is attached. Verified on POE 1.006 and 1.280 ( other releases not tested). -- Olivier Mengué - http://o.mengue.free.fr/
Subject: _child-from-detached-session.t
use strict; use warnings; use Test::More tests => 7; use POE; my $_child_fired = 0; POE::Session->create( inline_states => { _start => sub { $_[KERNEL]->alias_set('First'); pass "_start First"; POE::Session->create( inline_states => { _start => sub { $_[KERNEL]->alias_set('Second'); pass "_start Second"; }, }, ); POE::Session->create( inline_states => { _start => sub { $_[KERNEL]->alias_set('Detached'); pass "_start Detached"; diag "Detaching session 'Detached' from its parent"; $_[KERNEL]->detach_myself; }, }, ); }, _child => sub { $_child_fired++; ok($_[KERNEL]->alias_list($_[ARG1]) ne 'Detached', "$_[STATE]($_[ARG0]) fired for ".$_[KERNEL]->alias_list($_[ARG1]->ID)); }, }, ); POE::Kernel->run(); pass "_child not fired for session detached in _start" unless $_child_fired != 2; pass "Stopped";
Thank you for the bug report and test case.  I've committed your test case and a fix as revision 2764, and I hope to release it to CPAN with the next bundle of fixes... some time in the next few days.