in reply to Loading all modules under a directory
use doesn't really allow you much in the way of trickery and flexibility. You cannot "use" modules conditionally, or dynamically create use lists.
However, as is documented...
It is exactly equivalent to BEGIN { require Module; import Module LIST; } except that Module must be a bareword.
So here's another strategy for you. Within a BEGIN block, open the directory in which your modules reside, read it, keep all the *.pm filenames, and then in a foreach loop perform the above "require $_; import $_ LIST;" code.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Loading all modules under a directory
by BUU (Prior) on May 30, 2005 at 18:04 UTC | |
|
Re^2: Loading all modules under a directory
by ihb (Deacon) on May 30, 2005 at 21:59 UTC |