Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

You *Can* Catch errors in closing lexical filehandles

by Zaxo (Archbishop)
on Sep 27, 2004 at 15:17 UTC ( [id://394196]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ perl -e'eval{open my $fh, ">", "/dev/full"; print $fh "Foo\n";}; pri
    +nt $!'
    No space left on device
    
  2. or download this
    use Fatal qw/open close/;
    {
        $! = undef;
    ...
        print $fh 'short text' or die $!;
    }
    die $! if $!;
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2024-06-15 18:23 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.