Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Be careful about using Module::Pluggable. Each time you run your script Module::Pluggable has to search through the entire INC path, and as part of that searching it will load every matching module. So, you get a win in that you can abstract out parts of your code or use separate distributions. But you also get a heavy penalty in that you might be loading large chunks of code unrelated to your current task at hand.

If you don't care to allow for arbitrary extension by third parties, then I'd use something like autouse or AutoRole to mix in known functionality.

If you want third party extensions but without the bloat, then a mapping of method name to module name is a way to go.

Alternately you could use a hybrid approach and scan @INC for module names - but don't load them unless a method that maps to a module is called.

However, with all that said, Module::Pluggable might be doing exactly what you want. I haven't had any of my personal projects ever fall into that category.
my @a=qw(random brilliant braindead); print $a[rand(@a)];

In reply to Re: What is present best practices for lightweight plugins? by Rhandom
in thread What is present best practices for lightweight plugins? by BerntB

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2021-11-27 09:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?