dynamically loading perl modules

Discussion in 'Perl Misc' started by stig, Dec 30, 2006.

  1. stig

    stig Guest

    Hi.

    We are starting to build a small web portal in perl.
    Already at this stage we see the need to be able to plug-in certain functionality.


    strategy 1
    We have thought about a solution where we can put modules in a special directory.
    When the portal looks in that directory and find new modules it reads some information in via an API
    that each of the modules contains (eg: getName(), getVersion() ) and presents the modules on the web portal.

    strategy 2
    We have also though about a solution where we enable and disable modules based on information
    stored separately (in a database). This would be less dynamic but perhaps better for other reasons?


    The questions i have are:
    1. Is the first strategy good at all, or should we aim for the second?
    2. How can we dynamically load a module?
    3. Are there ways to ask a module which functions/methods it provides?
    4. Should i stop developing this in perl, and look for something else?

    thanks
    stig
     
    stig, Dec 30, 2006
    #1
    1. Advertisements

  2. stig

    Marc Espie Guest

    You might wish to look at how existing perl frameworks do it.

    For instance, Catalyst has some very extensive plugin support...
     
    Marc Espie, Jan 2, 2007
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.