How To Install Perl Modules

If you're trying to run a perl program and you get an error about a missing module (for example, "LWP/") then you just need to install that module (the slash becomes a double-colon, and the .pm is assumed, so in that example, you'd install "LWP::UserAgent").  Here's how.

Windows Users:

ActivePerl comes with a program called ppm or ppm3 that you can run from the command-line.  It will give you a "ppm>" prompt, at which you can type "search <module-name>" to find the exact name of the module you want, and then "install <module-name>" to install it.

Linux Users:

Run this command as root:

perl -MCPAN -e shell

The first time you run it, you'll have to say y or n to a bunch of configuration questions, but eventually you'll get a cpan prompt, at which you can type:

cpan> install <module-name>

Alternately, you can install a package non-interactively by just running:

perl -MCPAN -e 'install <module-name>'

And remember, in "module-name", use double-colons (::) in place of slashes (/), and don't type the .pm at the end.

Note that sometimes a module doesn't pass all of the tests that run during the build stage, but this is usually OK.  However, it will then refuse to install the module, so you'll have to install it with cpan> force install <module-name> or at the shell prompt perl -MCPAN -e 'force install <module-name>'.

Also note, if it doesn't seem to do anything when you try to install a module, and/or the connections just keep timing out or otherwise failing, type o conf urllist at the cpan prompt, which will show you which URLs it's using.  You can add new URLs like this:

o conf urllist unshift
o conf urllist unshift
o conf urllist unshift
o conf urllist unshift

If That Doesn't Work... me for help.