From: Rafael Garcia-Suarez Date: Tue, 23 Nov 2004 13:35:34 +0000 (+0000) Subject: Fix for bug: [perl #32562] __PACKAGE__ symbol has wrong value X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9508c957d44b9a653d85a843d414d761b7658938;p=p5sagit%2Fp5-mst-13.2.git Fix for bug: [perl #32562] __PACKAGE__ symbol has wrong value after eval or require p4raw-id: //depot/perl@23528 --- diff --git a/t/comp/package.t b/t/comp/package.t index 6781be4..d63e108 100755 --- a/t/comp/package.t +++ b/t/comp/package.t @@ -1,6 +1,6 @@ #!./perl -print "1..12\n"; +print "1..14\n"; $blurfl = 123; $foo = 3; @@ -67,4 +67,7 @@ print "$Q" =~ /^__ANON__=/ ? "ok 11\n" : "not ok 11\n"; print ref $Q eq "__ANON__" ? "ok 12\n" : "not ok 12\n"; +package bug32562; +print __PACKAGE__ eq 'bug32562' ? "ok 13\n" : "not ok 13\n"; +print eval '__PACKAGE__' eq 'bug32562' ? "ok 14\n" : "not ok 14\n"; diff --git a/toke.c b/toke.c index a7a9068..d798946 100644 --- a/toke.c +++ b/toke.c @@ -4305,7 +4305,7 @@ Perl_yylex(pTHX) case KEY___PACKAGE__: yylval.opval = (OP*)newSVOP(OP_CONST, 0, (PL_curstash - ? newSVsv(PL_curstname) + ? newSVpv(HvNAME(PL_curstash), 0) : &PL_sv_undef)); TERM(THING);