Posted on 2007-05-05 15:10:39-07 by grantmeng
POE windows problem (wheel::run)
Dear All, I'm a POE newbie and I'm trying to use POE (0.38) on Windows with Perl 5.8.4. But it seems the child process generated by Wheel::Run can't be killed at all. I have two scripts as follows:
######### parent.pl ################ use POE qw(Wheel::Run); POE::Session->create(inline _states => { _start => \&start, stop => \&stop } ); $poe_kernel->run; sub start { my ($heap, $session, $kernel) = @_[HEAP, SESSION, KERNEL]; $heap->{kid} = POE::Wheel::Run->new(Program => 'child.pl', StdoutEvent => STDOUT); $kernel->post($session => stop); } sub stop { my ($heap, $kernel) = @_[HEAP, KERNEL]; sleep(5); print "stopping child\n"; $heap->{kid}->kill(9); ### kill the child process # delete $heap->{kid}; ### make the parent alive all the time } ######### end parent.pl ##################### ######## child.pl ################# while (1) { open(TMP, '>>test.log'); print TMP "This is child\n"; close(TMP); } ####### end child.pl #######################
I did run the parent.pl in the command line first and used 'tasklist' command to check the processes. Both the parent (parent.pl) and the child ( child.pl ) were running there. If I decomment the line 'sleep(5)' in the parent.pl. Run it and check again. Yes, only parent.pl is running, but child.pl doesn't run at all, because the file test.log was not updated. Can anybody check the problem for me? Is that a bug of POE on Windows or just because Windows doesn't support fork/exec? Another question is, on Windows, how can I use POE::Wheel->kill() to send a special signal like SIGINT, SIGQUIT, etc, to the child process? Thanks for your response!!! Grant
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.