diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 1999-10-12 16:53:31 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 1999-10-12 16:53:31 +0000 |
commit | 72b166521443a1b89b0fed156fa8334cfab6e61b (patch) | |
tree | 1b861dc3472acd4a3bf3b2f7a4ed71e073c143f9 /op.c | |
parent | 883d36a60f1dbc0dec153bce822eebaa5172be5d (diff) | |
download | perl-72b166521443a1b89b0fed156fa8334cfab6e61b.tar.gz |
add File::BSDGlob as File::Glob and load it at compile-time
if perl was built with -DPERL_INTERNAL_GLOB
TODO: we currently get a compile-time failure if File/Glob.pm
can't be found; such failure needs to be made to emit a warning
and use the csh implementation instead
p4raw-id: //depot/perl@4356
Diffstat (limited to 'op.c')
-rw-r--r-- | op.c | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -3351,14 +3351,20 @@ S_new_logop(pTHX_ I32 type, I32 flags, OP** firstp, OP** otherp) if (k2 && k2->op_type == OP_READLINE && (k2->op_flags & OPf_STACKED) && ((k1->op_flags & OPf_WANT) == OPf_WANT_SCALAR)) + { warnop = k2->op_type; + } break; case OP_SASSIGN: if (k1->op_type == OP_READDIR || k1->op_type == OP_GLOB + || (k1->op_type == OP_NULL && k1->op_targ == OP_GLOB) || k1->op_type == OP_EACH) - warnop = k1->op_type; + { + warnop = ((k1->op_type == OP_NULL) + ? k1->op_targ : k1->op_type); + } break; } if (warnop) { @@ -3530,6 +3536,7 @@ Perl_newLOOPOP(pTHX_ I32 flags, I32 debuggable, OP *expr, OP *block) case OP_SASSIGN: if (k1->op_type == OP_READDIR || k1->op_type == OP_GLOB + || (k1->op_type == OP_NULL && k1->op_targ == OP_NULL) || k1->op_type == OP_EACH) expr = newUNOP(OP_DEFINED, 0, expr); break; @@ -3583,6 +3590,7 @@ Perl_newWHILEOP(pTHX_ I32 flags, I32 debuggable, LOOP *loop, I32 whileline, OP * case OP_SASSIGN: if (k1->op_type == OP_READDIR || k1->op_type == OP_GLOB + || (k1->op_type == OP_NULL && k1->op_targ == OP_GLOB) || k1->op_type == OP_EACH) expr = newUNOP(OP_DEFINED, 0, expr); break; @@ -5173,6 +5181,19 @@ Perl_ck_glob(pTHX_ OP *o) if (!((gv = gv_fetchpv("glob", FALSE, SVt_PVCV)) && GvIMPORTED_CV(gv))) gv = gv_fetchpv("CORE::GLOBAL::glob", FALSE, SVt_PVCV); +#if 1 /*def PERL_INTERNAL_GLOB */ + /* XXX this can be tightened up and made more failsafe. */ + if (!gv) { + OP *modname = newSVOP(OP_CONST, 0, newSVpvn("File::Glob", 10)); + modname->op_private |= OPpCONST_BARE; + ENTER; + utilize(1, start_subparse(FALSE, 0), Nullop, modname, + newSVOP(OP_CONST, 0, newSVpvn("globally", 8))); + gv = gv_fetchpv("CORE::GLOBAL::glob", FALSE, SVt_PVCV); + LEAVE; + } +#endif /* PERL_INTERNAL_GLOB */ + if (gv && GvIMPORTED_CV(gv)) { append_elem(OP_GLOB, o, newSVOP(OP_CONST, 0, newSViv(PL_glob_index++))); |