Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Catching errors in closing lexical filehandles

by gaal (Parson)
on Sep 27, 2004 at 05:53 UTC ( [id://394077]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://394077]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-06-15 17:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.