On Tue, 12 Feb 2002, W  P wrote:

> my problem is simple.  i have a number of scripts on my server, and i
> would like all of them to initially run a function defined by me.
> however, it would be burdensome to write that function over for every
> script.  creating a custom module, however, doesn't really seem that
> much easier.  i have read the chapter on modules in Programming Perl,
> and i am still not sure about a few things.  if i were to create my own
> module, what directory does it go in?

While writing a module is more work, it's better and safer, IMHO.  'use'
actually does a require, but has some other things it does, like proerply
imports exported sub names, etc.

As for which directory, use any directory you wish.  You can always put
the directory in the PERL5LIB environment variable, or, do this in your
files:

use lib '/path/to/Module'; #adds /path/to/Module to @INC
use Module;

BTW, . is already included in @INC, so you can put the moduel in the saem
directory as your script.

-- Brett
                                          http://www.chapelperilous.net/
------------------------------------------------------------------------
Where there's a will, there's a relative.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to