Always bless filehandles into IO::Handle:: - don't try for FileHandle:: first.
Nicholas Clark [Fri, 20 Nov 2009 10:23:54 +0000 (10:23 +0000)]
Given that FileHandle "is now a front-end to the IO::* classes" it seems
wasted effort to indirect through it.

sv.c

diff --git a/sv.c b/sv.c
index 45248db..397de23 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -1431,17 +1431,13 @@ Perl_sv_upgrade(pTHX_ register SV *const sv, svtype new_type)
 
        if (new_type == SVt_PVIO) {
            IO * const io = MUTABLE_IO(sv);
-           GV *iogv = gv_fetchpvs("FileHandle::", 0, SVt_PVHV);
+           GV *iogv = gv_fetchpvs("IO::Handle::", GV_ADD, SVt_PVHV);
 
            SvOBJECT_on(io);
            /* Clear the stashcache because a new IO could overrule a package
               name */
            hv_clear(PL_stashcache);
 
-           /* unless exists($main::{FileHandle}) and
-              defined(%main::FileHandle::) */
-           if (!(iogv && GvHV(iogv) && HvARRAY(GvHV(iogv))))
-               iogv = gv_fetchpvs("IO::Handle::", GV_ADD, SVt_PVHV);
            SvSTASH_set(io, MUTABLE_HV(SvREFCNT_inc(GvHV(iogv))));
            IoPAGE_LEN(sv) = 60;
        }