[Melbourne-pm] Promoting old-school file handles to io::handles

Toby Corkindale toby.corkindale at strategicdata.com.au
Tue Jan 12 16:34:19 PST 2010

Alfie John wrote:
> Hey,
> Seems to be working for me:
[snip code]
> So, unless I'm not understanding the problem, maybe Moose is getting in 
> the way? Try writing a small test script to get what you want and then 
> see if IO::Handle magic kicks in. Otherwise, i'm out of ideas :(

I've found it!

Some of the calling code was passing me filehandles that were, get this, 
overloaded fileglobs that were blessed. Like this:

package Fh;
sub new {
   # ...
   return bless \*FILEHANDLE;
sub DESTROY { close shift }

However, apparently doing that stops the IO::File promotion magic from 
working. Who would guessed.. >.<

More information about the Melbourne-pm mailing list