in reply to Re: Catching errors in closing lexical filehandles
in thread Catching errors in closing lexical filehandles

Hey, I didn't know about Fatal, cool. Unfortunately it seems broken on my system:
Cannot make a non-overridable builtin fatal at /usr/share/perl/5.8/Fat +al.pm line 108. BEGIN failed--compilation aborted at f.pl line 1.
I wonder, does this do anything different?
use Fatal qw/open close/; my $result = do { open my $fh, '>', '/dev/full'; print $fh "Foo\n"; }; print $result ? $result : $@, $/;
Also it's probably worth trying to put in an extra nonces value at the end of the block, like "37", just to disambiguate the value of print from some mysterious other factor.

Replies are listed 'Best First'.
Re^3: Catching errors in closing lexical filehandles
by Zaxo (Archbishop) on Sep 27, 2004 at 05:57 UTC

    Arrgh! I keep falling afoul of print not being overridable! Leave it off the import list. I'll correct the code above.

    After Compline,
    Zaxo