Hi, Shouldn't the code below print 1, 2, 3, 4 on separate lines to the file /tmp/test.txt?
If I comment out lines 537-538 of POE::Wheel::Run.pm, namely: $poe_kernel->select_pause_write($self->[HANDLE_STDIN]) unless ($self->[OCTETS_STDIN]); ... things work as (I) expected. Some cursory debugging suggests POE isn't flushing the buffer when the state returns, as the docs indicate. This behavior holds for the following tested systems, all running POE 0.3003: Mac OS X Perl 5.8.1 Redhat 7.3 Perl 5.6.1 Redhat 9.0 Perl 5.8.0 Also, even with the commented-out lines, it looks like I still need the 'doit' and 'shutdown' events to be separate (i.e., combining everything into the _start event doesn't work). Is that behavior intentional? Thanks, Dan #!/usr/bin/perl use strict; use POE qw(Wheel::Run); POE::Session->create( package_states => [ main => [qw( _start _stop doit shutdown err stderr close)] ] ); $poe_kernel->run(); sub _start { my $heap = $_[HEAP]; $heap->{wheel} = POE::Wheel::Run->new( Program => '/bin/cat > /tmp/test.txt', StderrEvent => "stderr", ErrorEvent => "err", CloseEvent => "close", ); $_[KERNEL]->yield("doit"); } sub doit { my ($kernel, $heap) = @_[KERNEL, HEAP]; print "Created wheel " . $heap->{wheel}->ID . "\n"; print "Sending...\n"; $heap->{wheel}->put( "1" ); $heap->{wheel}->put( "2" ); $heap->{wheel}->put( "3" ); $heap->{wheel}->put( "4" ); $kernel->yield('shutdown'); } sub shutdown { my $heap = $_[HEAP]; print "Shutting down...\n"; $heap->{wheel}->shutdown_stdin(); } sub _stop { } sub stderr { my ($input, $wheel_id) = $_[ARG0]..$#_; print "stderr from wheel $wheel_id: $input\n"; } sub err { my ($input, $wheel_id) = $_[ARG0]..$#_; print "Error from wheel $wheel_id: $input\n"; } sub close { my ($wheel_id) = $_[ARG0]..$#_; print "Close from wheel $wheel_id\n"; }