I'm really lost as to why it's not working :( The code in my start() method works beautifully. And if I move the code in my finish() method to the main program (having start() return $h), where I extract the data out of $h, then it works fine. But having the code in finish() and calling $o->finish() SOMEHOW loses the data in $h.package IPC_Class use strict; use warnings; sub new { shift; my $self = { 'cmds' => undef, @_ }; defined $self->{'cmds'} or die "ERROR: didn't get CMD in constructor +."; IPC::Shareable->clean_up_all; bless $self; return $self; } sub start { my $self = shift; my $fh_glob_ref = shift; ... # the cmd "grep 'zzz'" in the next line will fail. my $h = IPC::Run::start(['sort'], '<pipe', $fh_glob_ref, '|', ['grep +', 'zzz'], '>', $writefh, "2>", $writefh) or die "Error: $!\n"; $self->{'h'} = h; } sub finish { my $self = shift; $h = $self->{'h'}; if (!$h->finish()) { for ($h->full_results) { print "$_\n" }; } }
(Thanks for the note on IOS. Lesson learned.)
In reply to Re^2: IPC::Run harness question
by italdesign
in thread IPC::Run harness question
by italdesign
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |