Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^2: Plugin-type architecture

by philcrow (Priest)
on Jan 10, 2006 at 18:43 UTC ( [id://522274]=note: print w/replies, xml ) Need Help??


in reply to Re: Plugin-type architecture
in thread Plugin-type architecture

You could also simply let the user specify which plugins they want at compile or run time, instead of loading them all at once. For instance, you could have your caller's say
use YourModule qw( List Of Plugins );
Then in YourModule have an import like this:
use File::Spec; sub import { my $class = shift; foreach my $plugin ( @_ ) { my $fullname = File::Spec::catfile( $class, 'Plugin', "$plugin.pm" ); require $fullname; } }
This assumes that your plugins are really called YourModule::Plugin::Name and that they don't go deeper (so YourModule::Plugin::TopLevel::Name won't work). But you could change the way the name is formed to take care of that.

Phil

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://522274]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-20 04:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found