Rafael Garcia-Suarez <[EMAIL PROTECTED]> writes:
>Nick Ing-Simmons wrote:
>> 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.
>
>A new scope, yes, but a new namespace ?
>
>Given that my patch changed the behaviour of require'ing a file which
>doesn't contain a package declaration, I'm happy to discuss this; 

Does it affect 'do' as well?

>but
>the previous behaviour wasn't documented nor tested, and seems
>surprising to me.

It surprised me once, not that I was using it, but that 
various things that eval/required had to have package added 
before they did what I wanted. 
e.g. autosplit etc.

I suspect that behaviour was useful for perl4-ish .pl files
it may no longer matter...




Reply via email to