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'], '', $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" }; } }