gmpassos has asked for the wisdom of the Perl Monks concerning the following question:
Is that right?
Output:package foo ; print eval('__PACKAGE__');
The sense tell me that should be foo! I tested this on Perl 5.6.1 and 5.8.3 and the output is the same.main
Is that a bug or an odd behavior?
UP: Note that the main idea is not how to get foo as value. The idea is that __PACKAGE__ will always point to main unless we define the package inside the eval like this: eval('package foo ; __PACKAGE__'). This is very odd, since any code evaluated will make references to the local pakcage and not main.
Graciliano M. P.
"Creativity is the expression of liberty".
Back to
Seekers of Perl Wisdom