Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^3: How do I make the garbage collector throw an exception when it fails to auto-close a filehandle?

by ikegami (Pope)
on Jan 14, 2007 at 06:37 UTC ( #594617=note: print w/ replies, xml ) Need Help??


in reply to Re^2: How do I make the garbage collector throw an exception when it fails to auto-close a filehandle?
in thread How do I make the garbage collector throw an exception when it fails to auto-close a filehandle?

Nevermind. die in destrutor. Doesn't work.

use strict; use warnings; use ReleaseAction qw( on_release ); $| = 1; sub something { my $closer = on_release { print "on_release enter\n"; die("test"); print "on_release exit\n"; }; } print "pre\n"; something(); print "post\n";

outputs

pre on_release enter (in cleanup) test at script.pl line 11. post

Tested on 5.6.1 & 5.8.8


Comment on Re^3: How do I make the garbage collector throw an exception when it fails to auto-close a filehandle?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (11)
As of 2014-10-20 10:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (75 votes), past polls