Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > 9bc5442986852b4b0f56543d61a770fc > files > 14

perl-Proc-Fork-0.802.0-2.mga4.noarch.rpm

use strict;
use Proc::Fork;

use IO::Pipe;
my $p = IO::Pipe->new;

run_fork {
	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";
	}
};