bless file handles as FileHandle if loaded else IO::Handle
Subject: Re: More info regarding the Can't locate error message [PATCH]
lvirden@cas.org (Larry W. Virden) writes:
> use FileHandle;
> STDERR->open("/tmp/errorsfile","w");
This patch tries to fix the problem by auto-blessing handles as
'FileHandle' if the FileHandle package has been loaded and IO::Handle
otherwise. The snag is that STDOUT, STDIN, STDERR are initialized
before 'use FileHandle' executes, so they are all initially blessed as
IO::Handles. We compensate by reblessing them in FileHandle.pm:
This makes Larry's example as well as the following code work:
use FileHandle;
open(F, "/dev/null") or die;
F->seek(0, 1) or die;
p5p-msgid: hyb80drrz.fsf@bergen.sn.no