in reply to __PACKAGE__ in anonysub
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: __PACKAGE__ in anonysub
by thpfft (Chaplain) on Feb 19, 2005 at 20:07 UTC | |
by Tanktalus (Canon) on Feb 19, 2005 at 20:27 UTC | |
by thpfft (Chaplain) on Feb 19, 2005 at 20:52 UTC | |
by ikegami (Patriarch) on Feb 19, 2005 at 20:36 UTC | |
by thpfft (Chaplain) on Feb 19, 2005 at 21:05 UTC |