My name is Use of uninitialized value in concatenation (.) or string at opt.pl line 25. My name is Mud
Apparently, the 'MyName' option isn't getting registered properly during the creation of the session. But when I later set the same option using the option() command, it works fine.
Can someone spot what I'm doing wrong, most likely in my create() call? It's probably something stupid, but I just can't see it. Thanks for any help!
Tim
------------------------------------
#!/usr/bin/perl
use warnings; use strict; use POE;
POE::Session->create ( inline_states => { _start => \&startup, event1 => \&handler1, event2 => \&handler2, }, options => { 'MyName' => 'Tim' }, );
POE::Kernel->run();
sub startup { $_[KERNEL]->yield('event1'); }
sub handler1 { my $name = $_[SESSION]->option( 'MyName' ); print "My name is $name\n"; $_[KERNEL]->yield('event2'); }
sub handler2 { $_[SESSION]->option( 'MyName', 'Mud' ); my $name = $_[SESSION]->option( 'MyName' ); print "My name is $name\n"; }