in reply to IO:Pipe functioning

Correct me if I'm wrong, but the example you're trying to run is this one:

# example with IPC via pipe use strict; use IO::Pipe; use Proc::Fork; my $p = new IO::Pipe; parent { my $child = shift; $p->reader; print while ( <$p> ); waitpid $child,0; } child { $p->writer; print $p "Line 1\n"; print $p "Line 2\n"; exit; } retry { if( $_[0] < 5 ) { sleep 1; return 1; } return 0; } error { die "That's all folks\n"; };

This example works for me (after I install Proc::Fork).

The message you're getting (Can't locate object method "writer" via package "IO::Pipe::End") sounds to me as if IO::Pipe hasn't been loaded, but if that were the case, it should fail much earlier with the message: Can't locate object method "new" via package "IO::Pipe" (perhaps you forgot to load "IO::Pipe"?)

So I'm wondering if you've changed anything.

In general, when I want to run a child, I just use fork directly. For the kind of problem solved by the example, I use open with special '-|' second argument. For example:

# This forks implicitly my $child_pid = open my $child_fh, '-|'; if ( ! defined $child_pid ) { die "Can't fork: $!"; } if ( $child_pid ) { # parent print while ( <$child_fh> ); # this implicitly waits for the child close $child_fh or die "close on pipe failed: $!"; } else { # child # child's STDOUT is connected to the pipe print "Line 1\n"; print "Line 2\n"; exit; }