On Wed, 1 May 2013 10:04:15 -0500 Andy Bach <afb...@gmail.com> wrote:
> On Wed, May 1, 2013 at 9:22 AM, Manfred Lotz <manfred.l...@arcor.de> > wrote: > > > have a script where I log stuff to a file and the same time displays > > it to stdout using Log4perl. > > > > If you use the autodie perldoc example code: > eval { > close($fh); > > }; > > if ($@ and $@->isa('autodie::exception')) { > if ($@->matches('open')) { print "Error from > open\n"; } if ($@->matches(':io' )) { print "Non-open, IO > error.\n"; } } elsif ($@) { > # A non-autodie exception. > } > > You see that $fh is already closed - gets: > Non-open, IO error. > Without autodie the call to close returns 0 if the command is ok and 256 if the command fails. Sure, I could use eval. However, I would like to understand why close won't work in case the command fails. When did $fh be closed? -- Manfred -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/