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