Some light reading: perldoc perlmod perldoc perlmodlib perldoc perlmodstyle perldoc perlmodinstall perldoc -f use perldoc -f require etc. (full list perldoc perl, may vary depending on version)
Will wrote:
Greets Folks,
<snip>
In many of the books and manuals I have, it seems every author has a different opinion on where a perl library should go, and often authors seem to assume that the programmer has root access for module installs. My host is pretty supportive when it comes to installing modules, but sometimes I wish I could do it myself, and this would include both self-made modules as well as pure perl modules off of CPAN (because not-pure-perl modules would require root access).
Correct.
My questions have been - 1.) "How do I create the
library?", and 2.) "How do I use the library?" 3.)
"How do I install pure perl CPAN modules in the
library?"
Here are my solutions, and this is where I am hoping
to have someone tell me if I am correct or not.
#1.) I guess the answer to question one is simply to
create a directory somewhere within my user
access/document tree, and then give it the proper
access permissions.
Yes, assuming answer to #2.
Correct. The first simply adjusts Perl at compile time to look for modules in the additional directory. (See info about @INC for more details).#2.) Then to list the path to the library in the module calls, like this: use lib '/user/public_html/cgi-bin/library'; BUT, if I understand this correctly that is not enough because... in addition... I also need to explicitly state what modules to use from the library in other module calls... So that, for instance, if I had installed something like HTML::Template along with a module I created called "DBLogin" under that same path I just listed, then I would use it by saying: use lib '/user/public_html/cgi-bin/library'; #PLUS, use HTML::Template; use DBLogin;
Simply dropping a module into place *should* work with many pure perl modules, but won't with C dependencies, etc. for which you will need a compiler. This is going to be a case by case basis, and modules listed in CPAN (at least on the web) indicate whether they require a compiler or not. Unzipping them on windows and uploading should not affect the module itself, unless your FTP server/client is doing file transformations, assuming you know how to unzip them on the unix box it is probably better to do them there anyways as the lag is usually the network. Depending on your account setup you may also be able to install them directly using CPAN's command line interface.and so on... #3.) The third thing is that I am still unclear on how to put CPAN modules into the library. I guess one just downloads them from CPAN and then uploads them to the library (using ASCII and proper access permissions), but, still, if I unzipped a CPAN module on my Windows system before uploadingit, then would it cause any problems when I ftp-ed it to the server? Or, should I unzip them on Unix only?
perl -MCPAN -e shell for which you will have to specify a PREFIX switch when configuring (see this list's archive for more on this topic).
As for your own modules, I assume they are pure perl as most C hackers would understand the issues related to compiling, etc. Check out the documenation I noted at the top for more specifics, or there are several online tutorials about module writing.
The real key is putting the modules in a path specified in @INC or adding that path with a 'use lib' statement like you indicated to @INC in your script.
http://danconia.org
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]