[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Perl Tip 6: Install modules from CPAN
- To: <email@example.com>
- Subject: Perl Tip 6: Install modules from CPAN
- From: Ask Bjoern Hansen <firstname.lastname@example.org>
- Date: Fri, 8 Mar 2002 18:01:22 -0800 (PST)
- Delivered-To: mailing list email@example.com
- Delivered-To: moderator for firstname.lastname@example.org
- Mailing-List: contact email@example.com; run by ezmlm
To give feedback on this tip, please go to
One of the things that makes Perl so great is the vast selection of
readily available modules. With Perl you rarely have to reinvent the
wheel to talk to network servers, calculate dates, use databases,
parse HTML and hundreds if not thousands of other things.
The standard way to install a module is a bit different if you use
Unix or Windows.
(scroll down for unix instructions)
If you use Perl under CygWin, the instructions for Unix apply.
If you use ActiveState's ActivePerl then your best option is to use
the "ppm" (Programmer's Package Manager) tool.
ppm can be run by typing ppm in a command prompt window. To install
the MP3::Info module type
After installing you can at a command prompt run
to read the documentation for the newly installed module.
In the ppm shell, try also
to see a listing of modules, or
to search for MP3 related modules.
To learn more about ppm go to
ppm has loads of features, and there's a beta of "ppm3" too you might
want to check out.
You need to have various development tools installed to install
modules the standard way with CPAN.pm.
To get started, you need to be able to run commands as the owner of
your Perl files (usually root). It is also possible to install
modules as a different user if you don't have write access to the
system wide Perl installation. The process takes a bit more work and
will be covered in a later tip.
Anyway, when you have logged in (or su'ed) to the user owning the perl
files, run the command
perl -MCPAN -e shell
Often there's a small script installed with the name "cpan" that does
the same thing, if so you can just run that.
The first time you run the CPAN shell you'll have to configure it.
It'll interactively ask you a bunch of questions, each time providing
a reasonable default. On most systems you'll be able to just press
enter all the way through, except for choosing some nearby mirrors.
When you are through the configuration you are ready to install a
At the CPAN shell prompt you are now ready to install a module, type
to download the latest version, compile it, test it and install it.
If the module includes regression tests, CPAN.pm will run those and
not install the module if they fail. By using "force install" instead
of "install" you can override this, if you are sure the failures won't
After you leave the CPAN shell (with the 'quit' command) you can type
"perldoc MP3::Info" to read the documentation for your newly installed
A few other useful commands in the CPAN shell are
i /mp3/ - search for all modules with /mp3/ in the name
i MP3::Info - show information about this module
look MP3::Info - download a module and start a subshell where you
can look around before installing
readme MP3::Info - show the readme file for the module
? - show command summary
Another tip is that you can install stuff without actually starting
the CPAN shell; just run
perl -MCPAN -e 'install "MP3::Info"'
(of course substitute MP3::Info with the module you want to install).
For the full reference, run "perldoc CPAN" at your prompt or go to
(original link http://www.perldoc.com/perl5.6.1/lib/CPAN.html broken)
To unsubscribe: mail firstname.lastname@example.org
To subscribe: mail email@example.com
Or visit: http://learn.perl.org/tips/
Comments, suggestions? Send them to firstname.lastname@example.org
or via http://learn.perl.org/tips/feedback/tip6