As for #2, __PACKAGE__ is changed by the parser into a string constant expression. It is not a language function that is evaluated, it's just a compiler directive. You can see this by checking the output of Deparse on the previous example:package main; no strict 'refs'; *Foo::bar = sub { return __PACKAGE__ }; print Foo::bar(); # prints 'main'
*Foo::bar = sub { return 'main'; } ; print Foo::bar();
blokhead
In reply to Re: __PACKAGE__ in anonysub
by blokhead
in thread __PACKAGE__ in anonysub
by thpfft
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |