Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by Aristotle (Chancellor)
on Jan 14, 2007 at 01:41 UTC ( #594587=note: print w/replies, xml ) Need Help??


in reply to Re: 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?

Thanks for that link! Some interesting stuff in your thread which wasnít discussed here in mine.

Seems like clobbering IO::Handle::DESTROY is the only way to do this, but that itís at least reliable. Maybe I should put IO::Handle::CheckedAutoclose on the CPAN or something. :-)

Makeshifts last the longest.

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

Replies are listed 'Best First'.
Re^3: How do I make the garbage collector throw an exception when it fails to auto-close a filehandle?
by gaal (Parson) on Jan 14, 2007 at 05:52 UTC
    I don't like the extra scope and the fact that it's local at best. If you do put it on CPAN, make a note to say it isn't thread safe.

      Iíd want it global. Otherwise Iíd subclass IO::Handle and instantiate that class instead; that works just as well and wonít conflict with anything else.

      How does overriding DESTROY break thread safety?

      Makeshifts last the longest.

        If you attempted to limit the effect of the change to that one function (and those it calls) using local *IO::Handle::DESTROY = sub { ... };, your code wouldn't be thread-safe.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://594587]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2017-09-21 04:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (242 votes). Check out past polls.

    Notices?