I need to be able to start a child POE process that stays alive even 
when it has no events to keep it alive. The POE::Kernel man page
indicates that if I set an alias for the child, it will demonise itself
and stay alive. However when I try this with the following code ,
process with ID =5 still dies.

Why is this so?

Richard Liu

#!/usr/bin/perl -w
       use strict;

       # Use POE!
       use POE;

       sub handler_start {
         my ($kernel, $heap, $session) = @_[KERNEL, HEAP, SESSION];
         print "Session ", $session->ID, " has started.\n";
                 if ($session->ID == 5 ) {
                  print "Settin alias for ", $session->ID, "\n";
                  $kernel->alias_set('five');
                 }
         $heap->{count} = 0;
         $kernel->yield('increment');
       }

       sub handler_increment {
         my ($kernel, $heap, $session) = @_[KERNEL, HEAP, SESSION];
         print "Session ", $session->ID, " counted to ",
++$heap->{count}, ".\n";
         $kernel->yield('increment') if $heap->{count} < 10;
       }

       sub handler_stop {
         print "Session ", $_[SESSION]->ID, " has stopped.\n";
       }

       for (0..9) {
         POE::Session->create(
           inline_states =>
             { _start    => \&handler_start,
               increment => \&handler_increment,
               _stop     => \&handler_stop,
             }
         );
       }

       $poe_kernel->run();
       exit;



-- 
Richard Liu <[EMAIL PROTECTED]>

Reply via email to