note
revdiablo
<p>This is very similar to a plugin system that I built for (wait for it...) an IRC bot. I needed to be able to unload plugins, though. So instead of using [doc://require], I just used [doc://do]. This got rid of the <code>%INC</code> check, which is nice, but for my purposes just a hassle. I then used <code>delete_package</code> from [cpan://Symbol] (this is a core module) to remove the plugin. Also, instead of running the subroutines immediately, I store the coderef returned by <code>can()</code> in a dispatch table.</p>
<p>Obviously my plugins work a little differently due to their different purpose, but perhaps some others will find this information useful.</p>
366279
366279