[LA.pm] FW: Perl Modules [please delete previous]
David Cohen
cohen4 at mindspring.com
Tue Mar 4 00:35:44 CST 2003
Once more, with a proper subject line (please delete previous):
Here's another way or two:
Let's say your home directory is /home/sudarikov
And let's say you want to use XML::Twig.
First, install the module in your home directory.
Second, you get Perl to add the path to your home directory to its list of
library directories like so at the top of your Perl file:
#!/usr/bin/perl -I/home/sudarikov
(the "-I" includes the path that follows in @INC, the list of directories
that Perl knows to search for libraries)
And then, soon after, you say:
use "XML::Twig";
Alternatively, you can add the path to the PERL5LIB environment variable in
your Unix shell if you know how (you edit the file your shell uses to set
these variables--depending on which shell you are using, the name of the
file will be different--if you're using the "bash" shell, the file will be
.bashrc or if you're using the "c shell" (csh) then the file will be
.cshrc, etc.).
Then you can also say: use "XML::Twig";
There are other similar ideas--you can use "require" instead of "use", so
you can specify the file directly like this:
require "/home/sudarikov/XML/Twig.pm"
This doesn't require using the -I/home/sudarikov thing, but this is
uglier--you are not treating the thing like a library but like a file.
You might want to read this for more info on use and require,
etc.: http://take23.org/docs/guide/perl.xml/8
___
DC
More information about the Losangeles-pm
mailing list