develooper Front page | perl.perl5.porters | Postings from April 2018

[perl #133123] eval '__PACKAGE__' in debug mode do not return rightpackage

Thread Previous | Thread Next
From:
KES via RT
Date:
April 20, 2018 08:18
Subject:
[perl #133123] eval '__PACKAGE__' in debug mode do not return rightpackage
Message ID:
rt-4.0.24-24772-1524212273-1836.133123-15-0@perl.org
> outputs:
> 
>     notDB-outer
> 
> (which is what I expect).
> 

Yes, this is right. 
Thus the EXPR which is evaled in 'DB' package sees 'main' package
Does __PACKAGE__ will see also 'main' package or it will see 'DB' pacakge still??

I suppose it does. Because this is 'string eval' which:
> is executed as a block within the lexical context of the current Perl program, any outer lexical variables are visible to it, and any package variable settings

The 'eval' in DB package 
>doesn't see the usual surrounding lexical scope, but rather the scope of the first non-DB piece

The first non-DB piece is 'main' package, thus __PACKAGE__ should return 'main'

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=133123

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About