Peter Scott wrote:
Maybe I'm missing something, but the poster appears to be asking how to
achieve the common and useful pattern of plugins, where you control
dynamic behavior by deciding what modules are in a particular directory. Of course there's a lot more scaffolding than the poster alluded to, but
at some point you do have to load all the modules in a directory.  My
current favorite way is to eval each file one at a time and extract
package directives to push class names onto an array.
Ken: that won't work.  You need BEGIN blocks, glob(), and a require
followed by a $class->import inside the loop.

Every now and again someone gets the bright idea to load modules dynamically. Usually they do this to save time. The correct way to do this is to rewrite the modules for AutoLoader. Then you just 'use' everything. See `perldoc AutoLoader` for details.


--

Just my 0.00000002 million dollars worth,
   --- Shawn

"Probability is now one. Any problems that are left are your own."
   SS Heart of Gold, _The Hitchhiker's Guide to the Galaxy_

* Perl tutorials at http://perlmonks.org/?node=Tutorials
* A searchable perldoc is available at http://perldoc.perl.org/

--
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