This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
prefer IO::Handle for IO if FileHandle:: is empty (as suggested by
authorGurusamy Sarathy <gsar@cpan.org>
Sun, 29 Nov 1998 08:22:49 +0000 (08:22 +0000)
committerGurusamy Sarathy <gsar@cpan.org>
Sun, 29 Nov 1998 08:22:49 +0000 (08:22 +0000)
Tim Bunce)

p4raw-id: //depot/perl@2380

gv.c

diff --git a/gv.c b/gv.c
index beffabf..85ac8f9 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -875,7 +875,8 @@ newIO(void)
     SvREFCNT(io) = 1;
     SvOBJECT_on(io);
     iogv = gv_fetchpv("FileHandle::", FALSE, SVt_PVHV);
     SvREFCNT(io) = 1;
     SvOBJECT_on(io);
     iogv = gv_fetchpv("FileHandle::", FALSE, SVt_PVHV);
-    if (!iogv)
+    /* unless exists($main::{FileHandle}) and defined(%main::FileHandle::) */
+    if (!(iogv && GvHV(iogv) && HvARRAY(GvHV(iogv))))
       iogv = gv_fetchpv("IO::Handle::", TRUE, SVt_PVHV);
     SvSTASH(io) = (HV*)SvREFCNT_inc(GvHV(iogv));
     return io;
       iogv = gv_fetchpv("IO::Handle::", TRUE, SVt_PVHV);
     SvSTASH(io) = (HV*)SvREFCNT_inc(GvHV(iogv));
     return io;