in reply to Re^2: Require or Do vs. more maintenance
in thread Require or Do vs. more maintenance
At the top of your scripts (or in the initialization file for your web server), to tell perl where to look for libraries. Also, don't let the use scare you. It's built on the same mechanism as require, basically, there's just some more tricks involved. One consequence of those differences, though, is that you have to use module-names (where the path-separator is "::" and the path is relative to the library path(s)) with a use statement, whereas with require, you can use either a module-name or a file-nameuse lib qw( /path/to/my/libraries/ );
The two things that are different between use and require are that
will still use the module!if (0) { use Some::Module; }
Of course, if your module doesn't have an import method defined, nothing bad happens, because (since it's a method call, not a function call) it ascends up the class hierarchy to UNIVERSAL::import (...but I'm getting into details, here).BEGIN { require Foo::Bar; Foo::Bar->import(); }
Look at perldoc perlmodlib perldoc perlmod for more info. And good luck!
------------ :Wq Not an editor command: Wq
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Require or Do vs. more maintenance
by Stenyj (Beadle) on Jun 26, 2004 at 22:27 UTC | |
by etcshadow (Priest) on Jun 26, 2004 at 22:45 UTC | |
by fglock (Vicar) on Jun 26, 2004 at 22:42 UTC |