I wish I could point you to some resources on the topic, but I can give you my experience with Perl and plugin development.

Generally, each plugin should have a single point of interaction with your program. Normally, this is a package that implements an interface specified by the application. Then the plugin can have its own set of supporting libraries.

So, you might have an interface that all plugins meet. The interface can be as simple as a list of methods that the plugin's implimentation class needs to support. However, you could provide a partial implimentation that can be subclassed by the plugin developer.

Here is an example of how you might load plugins in your application. In this example, each plugin is a PM file located in a directory called plugins.

sub LoadPlugins { my %plugins = (); for (<"plugins/*.pm">) { my ($pluginName) = /plugins/(\w+)\.pm/; require $_; # Create a new instance $plugins{$pluginName} = $_->new; } return %plugins; }

Now, this is a very simple example, but should get you started.

Ted Young

($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)

In reply to Re: Plugin Programming by TedYoung
in thread Plugin Programming by theirpuppet

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.