diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-07-11 18:34:56 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-07-11 18:34:56 +0000 |
commit | def3634bd95d269e50804282110ddcc3b0e6e39b (patch) | |
tree | bb4c8c012460fb9e66e91602502d4bf2c698584a /toke.c | |
parent | 6662521eef19f96de52b97fb5fa07a85826679ee (diff) | |
download | perl-def3634bd95d269e50804282110ddcc3b0e6e39b.tar.gz |
integrate cfgperl change#6250 into mainline
p4raw-link: @6250 on //depot/cfgperl: ec6a9911b75518dd4c77eb4985d8bee0371df340
p4raw-id: //depot/perl@6360
p4raw-branched: from //depot/cfgperl@6250 'branch in' t/op/my_stash.t
p4raw-integrated: from //depot/cfgperl@6250 'copy in' MANIFEST
(@6232..) 'merge in' toke.c (@6241..) embed.pl proto.h
(@6243..)
Diffstat (limited to 'toke.c')
-rw-r--r-- | toke.c | 25 |
1 files changed, 24 insertions, 1 deletions
@@ -2006,6 +2006,29 @@ S_filter_gets(pTHX_ register SV *sv, register PerlIO *fp, STRLEN append) return (sv_gets(sv, fp, append)); } +STATIC HV *S_find_in_my_stash(pTHX_ char *pkgname, I32 len) +{ + GV *gv; + + if (*pkgname == '_' && strEQ(pkgname, "__PACKAGE__")) + return PL_curstash; + + if (len > 2 && + (pkgname[len - 2] == ':' && pkgname[len - 1] == ':') && + (gv = gv_fetchpv(pkgname, FALSE, SVt_PVHV))) { + return GvHV(gv); /* Foo:: */ + } + + /* use constant CLASS => 'MyClass' */ + if ((gv = gv_fetchpv(pkgname, FALSE, SVt_PVCV))) { + SV *sv; + if (GvCV(gv) && (sv = cv_const_sv(GvCV(gv)))) { + pkgname = SvPV_nolen(sv); + } + } + + return gv_stashpv(pkgname, FALSE); +} #ifdef DEBUGGING static char* exp_name[] = @@ -4410,7 +4433,7 @@ Perl_yylex(pTHX) s = scan_word(s, PL_tokenbuf, sizeof PL_tokenbuf, TRUE, &len); if (len == 3 && strnEQ(PL_tokenbuf, "sub", 3)) goto really_sub; - PL_in_my_stash = gv_stashpv(PL_tokenbuf, FALSE); + PL_in_my_stash = find_in_my_stash(PL_tokenbuf, len); if (!PL_in_my_stash) { char tmpbuf[1024]; PL_bufptr = s; |