in reply to eval('__PACKAGE__') is always main?!!!
this is odd...
hal:~> cat test.pl package foo ; print eval('__PACKAGE__'); hal:~> perl -l test.pl main hal:~> perl -le 'package foo ;print eval('__PACKAGE__');' foo
Update: d'oh! ... that's what i get for trusting someone else's test case without looking at it closely.
what makes the -e version "work" is definitely the quotes, perl is seeing it as...
package foo ;print eval(__PACKAGE__);
...in which case the __PACKAGE__ gets interpolated before the eval.
|
|---|