in reply to How not to hardcode a package name?
package Array::Extract; our $worker_pkg; ... package Array::Extract::Worker; BEGIN { $Array::Extract::worker_pkg = __PACKAGE__ } ...
(Not tested).
That works even for separate files, and can be overridden by other modules.
Update: I choose BEGIN out of habit, maybe something later like CHECK or INIT might be better, but then again they might cause problems with mod_perl.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How not to hardcode a package name?
by blazar (Canon) on Aug 28, 2008 at 10:41 UTC | |
by moritz (Cardinal) on Aug 28, 2008 at 10:57 UTC | |
by blazar (Canon) on Aug 28, 2008 at 12:32 UTC | |
|
Re^2: How not to hardcode a package name?
by betterworld (Curate) on Aug 28, 2008 at 16:02 UTC |