![]() |
|
Just another Perl shrine | |
PerlMonks |
Re: How to Teach artists Perl w/out Modulesby Sol-Invictus (Scribe) |
on Jan 31, 2004 at 15:07 UTC ( #325552=note: print w/replies, xml ) | Need Help?? |
Under Linux/Unix you can install CPAN or any other module in your user account and run it from there. If you don't have much diskspace you can just install the modules you need, though dependencies can make life awkward (see the trouble shooting section). Installing perl modules is fairly straight forward:
1. make a site_perl folder somewhere in your user account :
2. set the environment variable PERL5LIB :
you can check if it's set correctly by typing:
This only affects the Environment variables of the shell, not the system, so you may have to logout and re-login in before the new path will become active. If the echo command still doesn't seem to print anything, or, if it prints something different from what you typed even after logging out and in, then the variable hasn't been set correctly. Repeat the last few steps again to set the new path. 3. FTP the module into your site_perl folder
4. DECOMPRESS the file:
5. UNPACK the file :
6. BUILD the module (sometimes unnecessary):
7. INSTALL the module:
8. Troubleshooting: If you get errors about a file not being created:
i. create the path to the file as it was written in the error If the error says a module is missing - this is caused by dependancy, in other words the module you want uses another module:
i. FTP the missing module from ftp.CPAN.org into your site_perl folder as before After installation, in your scripts and cgis, insert the line (perl versions 5.002 and later):
or for earlier perls (5.001 and before):
so the perl interpreter will know to check your site_perl dir for modules. Installing CPAN.pm CPAN.pm was designed to free you out from the circular hell of dependancy. Follow the installation procedure as above, once installed and you've checked that the path to your site_perl folder is set correctly in the ENVIRONMENT variables you can start up the CPAN shell by typing:
the first time you run it you'll be prompted for config info, in most cases the default values are fine (just press enter without writing anything), but you must make sure you set the following two correctly for either CPAN.pm, or any modules it installs, to work correctly:
which outputs a listing of all the config variables* similar to this:
*note: the first 3 are commands To run this config script again at any time type (in the CPAN shell):
See the relevant MAN page or PODs for more information on how to set or unset these variables individually, either:
or:
Once installed correctly, adding other modules to your site_perl becomes a breeze - just type:
and CPAN.pm does the rest (including installing any other fish hooked modules). Equally as useful, through CPAN you can check for newer releases of existing modules and automatically install them as they become available, much like a package management system. For a brief summary of CPAN.pm's commands use the CPAN shell's own internal help function:
In Section
Seekers of Perl Wisdom
|
|