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?

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.
  • Comment on Re^3: How do I make the garbage collector throw an exception when it fails to auto-close a filehandle?
  • Download Code

Replies are listed 'Best First'.
Re^4: 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 06:19 UTC

    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.