Loading/Unloading POE::Component::PluginManager Plugins

Filed under: perl, computers by tamber
22 January 2010 @ 01:01

I’m using Perl’s PoCo::PluginManager module for plugins in Harlie’s plugins and unfortunately, whilst the documentation on CPAN covers all the code necessary for a plugin, it does not give an example of how to write the code for the application side (E.g. The program loading/unloading a plugin.), and it seems the author has gone missing. So, I have written an example to help anyone who hasn’t managed to figure it out. (It took me a day of dismantling the module to figure out how it worked, I know, I’m slow.)

(Assume that there’s a plugin called Test.pm in a subdirectory called Plugins, which prints debugging output when it’s loaded and unloaded. (You can grab an example of a plugin from the POE::Component::PluginManager page

use warnings;
use POE;
use POE::Component::PluginManager;
print STDERR "Plugin Loaded.";
print STDERR "Plugin Unloaded.";
print STDERR "PluginManager shut down";
return 0;