develooper Front page | perl.perl5.porters | Postings from September 2016

Re: [perl #129345] perlmod doc bug wrt package scope

Thread Previous | Thread Next
David Nicol
September 25, 2016 01:22
Re: [perl #129345] perlmod doc bug wrt package scope
Message ID:
thanks for this explanation! I too thought package replaced rather
than nested, and I was surprised to see this output:

$ perl -le 'package a; { print __PACKAGE__; package b;  print
__PACKAGE__; } print __PACKAGE__;'

I was expecting a, b, b. Was it initially broken, like in perl 5.0.0?

Anyway, some kind of improvement to the documentation of this makes
sense as it currently can be misinterpreted.


On Sat, Sep 24, 2016 at 4:56 PM, Zefram <> wrote:
> via RT wrote:
>>Does not mention that package scope ends at next package statement.
> It doesn't: the next package statement produces a nested package scope.
> The two scopes happen to have the same end point, so it's just a bit
> difficult to discern.
>>my() variable scopes cross package statement boundaries.
> Nested again.  You have a package scope inside a my scope inside a
> package scope.
> -zefram

"Teaching radical novelties is our main safeguard against
dictatorships" -- Edsger W. Dijkstra

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About