Perl Tutorials
Using WWW-Mechanize
Perl Basics

Perl Basics

Perl Modules

Perl modules are plugins that can be installed and used as needed. The CPAN module repository contains numerous modules extend Perl. Before writing scripts or application interfaces it's usually a good idea to search the CPAN module repository to see if the code is already available.

Installing modules from the cpan repository is easy. There are two methods for package installation. First use the cpan utility bundled with Perl. Second download the module from the CPAN website and build. The bundled cpan utility simplifies module installation, because it will resolve dependancies and prevent an afternoon of module compiles.

Installing a Perl module from CPAN

Installing a module on your system with CPAN is easy. As root execute 'cpan'. This will leave you with a CPAN prompt that's similar to a shell. At the prompt type 'install Module::Name' with Module::Name being the module to install. The module download and install process will scroll across the screen. If the module contains dependencies you'll be prompted with a list of the required modules and whether to install them. Once the install process is complete the cpan prompt will appear, type 'exit'.

Installing a Perl module from source

The source method described here assumes the module has been downloaded from CPAN or at a minimum packaged to the CPAN definitions. This installation method consists of three steps. First building the make file with 'perl Makefile.PL'. Then execute 'make'. Finally as root execute 'make install'. If you wish to test the module build before running 'make install' the command 'make test' can be run.

Using a perl module

Using a Perl module is as easy as 'use Module::Name;' and following the usage instructions.

Loops in Perl <<  1 2 3 4 5
New Content

Related Information
Using WWW-Mechanize