I suspect you can get most of what you want with require and perlboot. If that isn't helpful, please tell me how a plugin differs from a perl package and I will refine my answer.
UPDATE: some (untested) code as requested:
for my $potential (<plugin_dir/*.pm>) { eval qq( require "$potential" ); if( $@ ) { warn "plugin failed to load: $potential"; } else { if( $potential =~ m|plugin_dir/(.+?)\.pm| ) { my $c = $1; if( eval { $c->can("expected_method1") and $c->can("somethin +g_else") } ) { push @loaded_plugins, $c; } else { warn "$potential failed to load correctly"; } } }
Although, rather than rolling your own — which I barely started above, you'd be better off looking into some of the posts below. Of particular interest is "Re: How to make plugins."
-Paul
In reply to Re: How to make plugins
by jettero
in thread How to make plugins
by cub.uanic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |