in reply to Loading an unknown module
There's also the very handy autouse module which should do the magic for yousub routine { my $module = shift; my $routine = shift; my @params = @_; eval qq{ use "Foo::Bar::$module"; }; no strict 'refs'; return &{"Foo::Bar::$module::$routine"}(@params); }
I'm not sure if that's exactly how it should be used so checkout merlyn's Objects of runtime-determined classes for reference.sub routine { my $module = shift; my $routine = shift; my @params = @_; require autouse; autouse->import( "Foo::Bar::$module", "Foo::Bar::$module::$routine" ); no strict 'refs'; return &{"Foo::Bar::$module::$routine"}(@params); }
_________
broquaint
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Loading an unknown module
by lestrrat (Deacon) on Jun 28, 2002 at 00:05 UTC | |
by broquaint (Abbot) on Jun 28, 2002 at 12:31 UTC |