in reply to Passing a run time string to require
There is a hack that makes "require" work almost natural, although it doesn't reraise fatal errors - UNIVERSAL::require. It makes "require" a method that can be called on any scalar, which is quite convenient if you need to dynamically load modules:
my $module = __PACKAGE__ . "::Plugin\::$class"; if (! $module->require) { warn "$module didn't return a true value:"; croak $@; };
Of course, depending on your actual needs, maybe one of the Plugin modules already does what you want...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Passing a run time string to require
by rinceWind (Monsignor) on Oct 22, 2004 at 23:29 UTC | |
by BUU (Prior) on Oct 23, 2004 at 03:46 UTC | |
by rinceWind (Monsignor) on Oct 23, 2004 at 08:32 UTC | |
by BUU (Prior) on Oct 23, 2004 at 09:07 UTC |