hi all, I need to run a interactive perl script on the remote machine so I followed the code at http://poe.perl.org/?POE_Cookbook/Job_Server to wrote a poe job server, I got the script to run except one problem:
] when I finished the "perlit" which is a script asking me for the username and password here, the child process created by POE::Wheel::Run just went into the status of "zombie", which mean that it was not reaped by the parent process, dose any one know the reason for this?
below is the code
use POE qw/Component::Server::TCP Wheel::Run/; *POE::Kernel::USE_SIGCHLD = sub (){1}; $SIG{CHLD} = 'ignore'; my %program = ( time => '/bin/date', perlit => 'perl get_name.pl', ); POE::Component::Server::TCP->new( Alias => 'Job Server', Port => 32080, ClientConnected => sub { $_[KERNEL]->yield('usage'); }, ClientDisconnected => sub { delete $_[HEAP]->{job}; }, ClientInput => sub { my ($heap, $input) = @_[HEAP, ARG0]; if ($heap->{job}) { $heap->{job}->put($input); return; } my $program = $program{$input}; unless (defined $program) { $_[KERNEL]->yield('usage'); return; } $heap->{job} = POE::Wheel::Run->new( Program => $program, StdioFilter => POE::Filter::Line->new(), StderrFilter => POE::Filter::Line->new(), Conduit => 'pty', StdoutEvent => 'got_job_stdout', StderrEvent => 'got_job_stderr', CloseEvent => 'got_job_close', ); $heap->{client}->put('Job' . $heap->{job}->PID . 'Started'); }, InlineStates => { got_job_stdout => sub { my $heap = $_[HEAP]; $heap->{client}->put($_[ARG0]); }, got_job_stderr => sub { my $heap = $_[HEAP]; $heap->{client}->put('ERR' . $_[ARG0]); }, got_job_close => sub { my ($heap, $kernel) = @_[HEAP, KERNEL]; my $job = delete $heap->{job}; $heap->{client}->put('Job' . $job->PID . ' Stopped'); }, usage => sub { my @commands = sort keys %program; $_[HEAP]->{client}->put("Commands : @commands"); }, } ); $poe_kernel->run();

In reply to child reap in poe? by woosley

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.