On Wed, 1 May 2013 11:50:05 -0400
Brandon McCaig <bamcc...@gmail.com> wrote:

> On Wed, May 01, 2013 at 11:45:00AM -0400, Brandon McCaig wrote:
> > One thing that I know bit me with the 'or die' pattern is that
> > with a pipe if the child process exits with an non-zero exit
> > status then close returns undef, ...
> 
> Sorry, close returns false to signal failure, not undef.
> 
> >   close $fh or $? != 0 or die "close: $!";
> 
> Reading over the perldoc again, the correct check might be $!,
> not !?. I guess if the only reason close is signalling failure is
> the exit status of the child process then close will set $! to 0.
> So perhaps...
> 
>   close $fh or $! == 0 or die "close: $!";
> 
> Hopefully that covers all of my errors.. >_<
> 
> Regards,
> 
> 

Thanks for your detailed explanations. I think that close should work
as I cannot see any reason why a failure of a command closes the pipe
prematurely.

-- 
Manfred

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to