Hello,
I thought this was an elegantly short testcase but alas it is a wrong
testcase. Here's my test case with the outputs I got:
This is perl, v5.10.0 built for x86_64-linux-gnu-thread-multi
POE v1.287
apoc@blackhole:~$ cat testmcfist.pl
use strict;
use warnings;
use POE;
open FH, '<', $0;
sub try
{
my $sess = POE::Session-> create( inline_states => { _start => sub { }, });
my $k = $POE::Kernel::poe_kernel;
$k-> select_read(\*FH, 'handle');
$k-> run_one_timeslice;
$k-> select_read(\*FH);
$k-> run_one_timeslice;
}
try();
try();
POE::Kernel-> run;
apoc@blackhole:~$ perl testmcfist.pl
apoc@blackhole:~$ perl -w testmcfist.pl
Use of uninitialized value $sid in delete at
/usr/local/share/perl/5.10.0/POE/Resource/SIDs.pm line 73.
apoc@blackhole:~$ POE_ASSERT_DEFAULT=1 perl -w testmcfist.pl
<us> must call select_read() from a running session at
/usr/local/share/perl/5.10.0/POE/Kernel.pm line 2186
POE::Kernel::select_read('POE::Kernel=ARRAY(0x1797438)',
'GLOB(0x158cb50)', 'handle') called at testmcfist.pl line 11
main::try() called at testmcfist.pl line 17
8909: Sessions were started, but POE::Kernel's run() method was never
8909: called to execute them. This usually happens because an error
8909: occurred before POE::Kernel->run() could be called. Please fix
8909: any errors above this notice, and be sure that POE::Kernel->run()
8909: is called. See documentation for POE::Kernel's run() method for
8909: another way to disable this warning.
apoc@blackhole:~$
apoc@blackhole:~$ cat testmcfist_myver.pl
use strict;
use warnings;
use POE;
open FH, '<', $0;
sub try {
POE::Session-> create(
inline_states => {
_start => sub {
$_[KERNEL]->yield( 'mystart' );
return;
},
mystart => sub {
$_[KERNEL]->select_read( \*FH, 'handle' );
$_[KERNEL]->run_one_timeslice;
$_[KERNEL]->select_read( \*FH );
$_[KERNEL]->run_one_timeslice;
return;
},
_stop => sub {}, # to shut up ASSERT
handle => sub {
warn "Got HANDLE\n";
return;
},
},
);
}
try();
try();
POE::Kernel-> run;
apoc@blackhole:~$ perl testmcfist_myver.pl
Got HANDLE!
Got HANDLE!
Got HANDLE!
Got HANDLE!
apoc@blackhole:~$ perl -w testmcfist_myver.pl
Got HANDLE!
Got HANDLE!
Got HANDLE!
Got HANDLE!
apoc@blackhole:~$ POE_ASSERT_DEFAULT=1 perl -w testmcfist_myver.pl
Got HANDLE!
Got HANDLE!
Got HANDLE!
Got HANDLE!
apoc@blackhole:~$
--
~Apocalypse