summaryrefslogtreecommitdiff
path: root/op.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-04-28 21:27:40 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-05-21 21:36:36 -0700
commit39e3b1bcb1568b34b8b8303630cb1bc8dad1eb14 (patch)
treefe107f808df608637b478d98adc1ea50c3e15161 /op.c
parent3dd32f5688d5d8551d930973f2fac3251cba505d (diff)
downloadperl-39e3b1bcb1568b34b8b8303630cb1bc8dad1eb14.tar.gz
op.c:ck_glob: Check PL_globhook before loading File::Glob
By loading File::Glob when there is no CORE::GLOBAL::glob, we just end up calling Perl_load_module for every glob op, since File::Glob no longer uses CORE::GLOBAL::glob by default. We could just as well check whether PL_globhook is set, which would be faster. (File::Glob sets PL_globhook when it loads. In 5.14, it didn’t set anything, but ck_glob itself would set CORE::GLOBAL::glob to File::Glob::csh_glob.)
Diffstat (limited to 'op.c')
-rw-r--r--op.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/op.c b/op.c
index 65195214f4..25a93d845c 100644
--- a/op.c
+++ b/op.c
@@ -8145,15 +8145,6 @@ Perl_ck_glob(pTHX_ OP *o)
gv = gv_fetchpvs("CORE::GLOBAL::glob", 0, SVt_PVCV);
}
-#if !defined(PERL_EXTERNAL_GLOB)
- if (!(gv && GvCVu(gv) && GvIMPORTED_CV(gv))) {
- ENTER;
- Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT,
- newSVpvs("File::Glob"), NULL, NULL, NULL);
- LEAVE;
- }
-#endif /* !PERL_EXTERNAL_GLOB */
-
if (gv && GvCVu(gv) && GvIMPORTED_CV(gv)) {
/* convert
* glob
@@ -8181,6 +8172,14 @@ Perl_ck_glob(pTHX_ OP *o)
return o;
}
else o->op_flags &= ~OPf_SPECIAL;
+#if !defined(PERL_EXTERNAL_GLOB)
+ if (!PL_globhook) {
+ ENTER;
+ Perl_load_module(aTHX_ PERL_LOADMOD_NOIMPORT,
+ newSVpvs("File::Glob"), NULL, NULL, NULL);
+ LEAVE;
+ }
+#endif /* !PERL_EXTERNAL_GLOB */
gv = newGVgen("main");
gv_IOadd(gv);
#ifndef PERL_EXTERNAL_GLOB