[OT] perl file handle question

Jonathan Rockway jon at jrock.us
Sun Mar 16 02:42:15 GMT 2008


* On Sat, Mar 15 2008, Dirk Koopman wrote:

> use IO::File;
>
> $fn = "a_file";
> $fh = new IO::File $fn;
> $$fh->{fn} = $fn;
>
> You can stash any old stuff in there. You are actually using the
> {HASH} part of the glob. So you are not limited simply to one scalar
> value.

Incidentally, there is a Moose instance metaclass for making Moose work
with glob-based objects (instead of the usual hash-based ones).

  http://search.cpan.org/~dexter/MooseX-GlobRef-Object-0.0202/lib/MooseX/GlobRef/Object.pm

Also incidentally, the example they use is a glob that remembers its
filename :)  Cut-n-paste and your problems are solved.

Regards,
Jonathan Rockway

-- 
print just => another => perl => hacker => if $,=$"


More information about the london.pm mailing list