diff options
author | Doug MacEachern <dougm@covalent.net> | 2001-07-30 10:38:50 -0700 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2001-08-01 16:26:25 +0000 |
commit | 18fc948826e2e527e52b790d8ec042fac21d6b8a (patch) | |
tree | ce0403d860e73b8295198c406d0fdf54fab1b755 | |
parent | af68e658651cf56700790e24ea04a752928b0df4 (diff) | |
download | perl-18fc948826e2e527e52b790d8ec042fac21d6b8a.tar.gz |
Re: [PATCH pp_ctl.c] proposed Windows safe-guard
Message-ID: <Pine.LNX.4.21.0107301720310.25941-100000@mako.covalent.net>
p4raw-id: //depot/perl@11537
-rw-r--r-- | op.c | 18 | ||||
-rw-r--r-- | t/TestInit.pm | 2 |
2 files changed, 20 insertions, 0 deletions
@@ -3217,6 +3217,9 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *id, OP *arg) OP *pack; OP *imop; OP *veop; + char *packname = Nullch; + STRLEN packlen; + SV *packsv; if (id->op_type != OP_CONST) Perl_croak(aTHX_ "Module name must be constant"); @@ -3274,6 +3277,12 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *id, OP *arg) newSVOP(OP_METHOD_NAMED, 0, meth))); } + if (ckWARN(WARN_MISC) && imop && SvPOK(packsv = ((SVOP*)id)->op_sv)) { + /* BEGIN will free the ops, so we need to make a copy */ + packlen = SvCUR(packsv); + packname = savepvn(SvPVX(packsv), packlen); + } + /* Fake up the BEGIN {}, which does its thing immediately. */ newATTRSUB(floor, newSVOP(OP_CONST, 0, newSVpvn("BEGIN", 5)), @@ -3285,6 +3294,15 @@ Perl_utilize(pTHX_ int aver, I32 floor, OP *version, OP *id, OP *arg) newSTATEOP(0, Nullch, veop)), newSTATEOP(0, Nullch, imop) )); + if (packname) { + if (ckWARN(WARN_MISC) && !gv_stashpvn(packname, packlen, FALSE)) { + Perl_warner(aTHX_ WARN_MISC, + "Package `%s' not found " + "(did you use the incorrect case?)", packname); + } + safefree(packname); + } + PL_hints |= HINT_BLOCK_SCOPE; PL_copline = NOLINE; PL_expect = XSTATE; diff --git a/t/TestInit.pm b/t/TestInit.pm index be69c24d7a..a2a074e13f 100644 --- a/t/TestInit.pm +++ b/t/TestInit.pm @@ -13,6 +13,8 @@ # PS this is not POD because this should be a very minimalist module in # case of funaemental perl breakage. +package TestInit; + chdir 't' if -d 't'; @INC = '../lib'; $0 =~ s/\.dp$//; # for the test.deparse make target |