in reply to How not to hardcode a package name?
A little convention can go a long way:
$class->SUPER::import(ARRAY => __PACKAGE__.'::Work');
If you want to be more fancy/flexible, you could do it like this:
package Array::Extract; my $worker_package = __PACKAGE__ . '::Work'; # or whatever other name +you want sub worker_extract { ... your code ... }; { no strict 'refs'; *{"$worker_package\::extract"} = \&worker_extract; };
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How not to hardcode a package name?
by blazar (Canon) on Aug 28, 2008 at 10:18 UTC | |
by Corion (Patriarch) on Aug 28, 2008 at 10:35 UTC |