On 4/19/05, Robin <[EMAIL PROTECTED]> wrote:
> Hi, I'm using Module::Pluggable to give a program plugin support.
> Basically, I'll have a directory full of .pm files and I want them to be
> loaded and instantiated. That's all well and good, however all the
> examples at
> http://search.cpan.org/dist/Module-Pluggable/lib/Module/Pluggable.pm
> seem to presume that you know the path at code-writing time, which isn't
> the case for me. Basically what I have is the path to the plugins being
> passed in when my own PluginMgr class is being instantiated, and then I
> want to give that information to Module::Pluggable and have it load them
> all up for me.
> 
> How can I do this? Or perhaps do it in a different way by manually running
> through the directory and "require'ing" each file. The problem I have
> with that method is that I don't know how to get the class name out so
> that I can then instantiate it.
> 
> --
> Robin <[EMAIL PROTECTED]>             JabberID: <[EMAIL PROTECTED]>
> 

Robin,

What does your current code look like, and what errors is it
returning.  From the docs, it looks at though most of what you need is
evaluated at runtime:  "The method search_path is exported into you
namespace as well. You can call that at any time to change or replace
the search_path."  If you're designing it, you can also make the paths
relative, and tell your users what directory they have to keep modules
in.  Most applications that allow plugins do this.  eval blocks will
also dely things until runtime.  you have lots of options here,
depending on what exactly it is your trying to to.  Post some code,
and people can help you with it.

--jay

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to