in reply to Re: How not to hardcode a package name?
in thread How not to hardcode a package name?
The package of a line of code is set when that line is compiled.
Furthermore, package is lexically scoped, so you can't just put the eval in a BEGIN.
You can do
my $p = 'Package'; my $c = 'print(__PACKAGE__);'; # Some code eval "package $a; $c";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How not to hardcode a package name?
by JadeNB (Chaplain) on Aug 28, 2008 at 20:48 UTC | |
by ikegami (Patriarch) on Aug 28, 2008 at 21:01 UTC |