Skip Menu |

This queue is for tickets about the POE CPAN distribution.

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

People
Owner: Nobody in particular
Requestors: callek [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Date: Sat, 22 Oct 2005 03:48:20 -0400
To: bug-poe [...] rt.cpan.org
Subject: sig( UIDESTROY => 'foo' ) does not work
From: "Justin Wood (Callek)" <callek [...] gmail.com>
sig( UIDESTROY => 'foo' ); does not seem to fire 'foo' when using Tk. I am using ActiveStatePerl build 813 (Windows XP) Tk version 804.27.0.2 (from activestate ppm) POE version 0.302 (from winnipeg [Location: http://theoryx5.winnipeg.ca/ppms/] ppm) Test Script follows ====== signs ;-) I will ok this e-mail to be transmitted to anyone assumed to be able to fix it. This includes mass-mailings of potential developers. ~Justin Wood (Callek) ===================== #!/usr/bin/perl use warnings; use strict; # Tk support is enabled if the Tk module is used before POE itself. use Tk; use POE; # Create the session that will drive the user interface. POE::Session->create ( inline_states => { _start => \&ui_start, ev_test_speed => \&TestSpeed, Bastard => \&Amazing, } ); # Run the program until it is exited. $poe_kernel->run(); exit 0; sub TestSpeed { print "Testing Speed\n"; } sub Amazing { print "Wheels Cancel\n"; } sub ui_start { my ( $kernel, $session, $heap ) = @_[ KERNEL, SESSION, HEAP ]; $kernel->sig( UIDESTROY => 'Bastard' ); $poe_main_window->Label( -text => "Counter" )->pack; $poe_main_window->Button ( -text => "Checkout Branch", -command => $session->postback( ev_test_speed => 9 ) )->pack; } 1; __END__
[callek@gmail.com - Sat Oct 22 03:48:38 2005]: Show quoted text
> sig( UIDESTROY => 'foo' ); does not seem to fire 'foo' when using Tk. > > I am using ActiveStatePerl build 813 (Windows XP) > > Tk version 804.27.0.2 (from activestate ppm) > POE version 0.302 (from winnipeg [Location: > http://theoryx5.winnipeg.ca/ppms/] ppm)
This 'problem' exists on any pretty much every version of POE thru .3202 Show quoted text
> Test Script follows ====== signs ;-) > > I will ok this e-mail to be transmitted to anyone assumed to be able to > fix it. This includes mass-mailings of potential developers.
Below is a fix for your test according to the semantics of POE v.3202. Show quoted text
> ~Justin Wood (Callek) > > ===================== > > #!/usr/bin/perl > > use warnings; > use strict; > > # Tk support is enabled if the Tk module is used before POE itself. > > use Tk; > use POE; > # Create the session that will drive the user interface. > > POE::Session->create > ( inline_states => > { _start => \&ui_start, > ev_test_speed => \&TestSpeed, > Bastard => \&Amazing, > } > ); > > # Run the program until it is exited. > > $poe_kernel->run(); > > exit 0; > > sub TestSpeed { > print "Testing Speed\n"; > } > > sub Amazing { > print "Wheels Cancel\n";
$_[KERNEL]->refcount_decrement( $_[SESSION]->ID, "Banana" ); Show quoted text
> } > > sub ui_start { > my ( $kernel, $session, $heap ) = @_[ KERNEL, SESSION, HEAP ]; > > $kernel->sig( UIDESTROY => 'Bastard' );
$kernel->refcount_increment( $session->ID, "Banana" ); Show quoted text
> > $poe_main_window->Label( -text => "Counter" )->pack; > > $poe_main_window->Button > ( -text => "Checkout Branch", > -command => $session->postback( ev_test_speed => 9 ) > )->pack; > > } > > > 1; > __END__ > >
This happens because your session is destructing before the UIDESTROY signal is dispatched. I proposed a semantics change (and will patch POE to follow suit) on the mailing list early last week. The change would make registered signal handlers keep sessions alive.
Jonathan Steinert (HACHI) made the change he promised. It'll be included in the next CPAN release. Thanks for your feedback!