Rafael Garcia-Suarez <[EMAIL PROTECTED]> writes:
>Mark-Jason Dominus (via RT) wrote:
>>
>> perl -le 'package D; eval q{print __PACKAGE__}'
>>
>> This prints "main", but it should print "D".
>
>This very simple patch appears to fix it :
It may _change_ it, but is it a fix?
__PACKAGE__ reflects the current package of the lexical scope.
eval "" and require start a new scope.
>
>--- toke.c (revision 4047)
>+++ toke.c (working copy)
>@@ -4305,7 +4305,7 @@
> 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);
>
>End.
>
>Now, this might be only an indication of a deeper problem with PL_curstname,
>which might not be correctly set everytime it should.