The following code gives me two identical read errors.  Is there a way to
tell which is associated with the close of the stdout file handle?

    use POE qw(Filter::Line Wheel::Run);
    use Time::HiRes 'time';
    use Data::Dumper;
    use strict;
    use warnings;

    sub output {
        print join (
            ':', time(), $_[SESSION]->ID, 'got',
            map( { defined($_) ? $_ : "" }
                @_[ STATE, ARG0, ARG1, ARG2, ARG3, ARG4, ARG5, ARG6 ]
            )),
            "\n";
    }

    POE::Session->create(
        inline_states => {
            _start => sub {
                my $heap = $_[HEAP];

                $heap->{wheel} = POE::Wheel::Run->new(
                    Program     => [qw( /usr/bin/find .. -type f )],
                    ErrorEvent  => 'error',
                    StdinEvent  => 'stdin',
                    StdoutEvent => 'stdout',
                    StderrEvent => 'stderr',
                    Filter      => POE::Filter::Line->new(),
                );

                $_[KERNEL]->sig( 'CHLD', 'child' );
            },
            error  => \&output,
    #       stdin  => \&output,
    #       stdout => \&output,
    #       stderr => \&output,
            child  => \&output,
        }
    );

    $poe_kernel->run();

    exit 0;

--
    Chris Fedde

Reply via email to