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,


-- 
Brandon McCaig <bamcc...@gmail.com> <bamcc...@castopulence.org>
Castopulence Software <https://www.castopulence.org/>
Blog <http://www.bamccaig.com/>
perl -E '$_=q{V zrna gur orfg jvgu jung V fnl. }.
q{Vg qbrfa'\''g nyjnlf fbhaq gung jnl.};
tr/A-Ma-mN-Zn-z/N-Zn-zA-Ma-m/;say'

Attachment: signature.asc
Description: Digital signature

Reply via email to