Perl

The Perl interpreter is installed on all WebFaction machines. The currently installed version is 5.8.8. You can run the Perl interpreter as perl or perl5.8.8.

Installing CPAN Modules

CPAN is the Comprehensive Perl Archive Network, a mirrored archive of Perl modules. The cpan tool downloads and installs Perl modules from CPAN.

Before using cpan, you must first configure the command line tool.

Using cpan on CentOS 6 Servers

To configure cpan on servers Web300 or greater or Dweb89 or greater:

  1. Open an SSH session to your account.

  2. Create a directory for the Perl libraries Enter mkdir -p $HOME/lib/perl5 and press Enter.

  3. Add the PERL5LIB environment variable to your .bashrc file. Enter echo 'export PERL5LIB=${PERL5LIB}:~/lib/perl5:~/lib/perl5/lib64/perl5:~/lib/perl5/lib:~/lib/perl5/lib/i386-linux-thread-multi/:~/lib/perl5/share/perl5' >> $HOME/.bashrc and press Enter.

  4. Source the .bashrc file to update to the environment variable. Enter source $HOME/.bashrc and press Enter.

  5. Start the CPAN setup. Enter perl -MCPAN -e shell and press Enter. The following prompt appears:

    CPAN is the world-wide archive of perl resources. It consists of about
    300 sites that all replicate the same contents around the globe. Many
    countries have at least one CPAN site already. The resources found on
    CPAN are easily accessible with the CPAN.pm module. If you want to use
    CPAN.pm, lots of things have to be configured. Fortunately, most of
    them can be determined automatically. If you prefer the automatic
    configuration, answer 'yes' below.
    
    If you prefer to enter a dialog instead, you can answer 'no' to this
    question and I'll let you configure in small steps one thing after the
    other. (Note: you can revisit this dialog anytime later by typing 'o
    conf init' at the cpan prompt.)
    Would you like me to configure as much as possible automatically? [yes]
    
  6. Press Enter. The configuration process will proceed until the cpan[1]> prompt appears.

  7. Enter o conf makepl_arg PREFIX=~/lib/perl5 LIB=~/lib/perl5/lib INSTALLMAN1DIR=~/lib/perl5/man1 INSTALLMAN3DIR=~/lib/perl5/man3 and press Enter.

  8. Save your configuration. Enter o conf commit and press Enter.

  9. Press Ctrl + D to exit.

You can now install CPAN modules. To install a module with cpan, enter cpan module_name. For example, cpan Locale::gettext.

Configuring cpan on CentOS 5 Servers

To configure cpan on servers less than Web300 or less than Dweb89:

  1. Open an SSH session to your account.

  2. Create a directory for the Perl libraries Enter mkdir -p $HOME/lib/perl5 and press Enter.

  3. Add the PERL5LIB environment variable to your .bashrc file. Enter echo 'export PERL5LIB=${PERL5LIB}:~/lib/perl5:~/lib/perl5/lib:~/lib/perl5/lib/i386-linux-thread-multi/:~/lib/perl5/share/perl5' >> ~/.bashrc and press Enter.

  4. Source the .bashrc file to update to the environment variable. Enter source $HOME/.bashrc and press Enter.

  5. Start the CPAN setup. Enter perl -MCPAN -e shell and press Enter. The following prompt will appear:

    CPAN is the world-wide archive of perl resources. It consists of about
    100 sites that all replicate the same contents all around the globe.
    Many countries have at least one CPAN site already. The resources found
    on CPAN are easily accessible with the CPAN.pm module. If you want to
    use CPAN.pm, you have to configure it properly.
    
    If you do not want to enter a dialog now, you can answer 'no' to this
    question and I'll try to autoconfigure. (Note: you can revisit this
    dialog anytime later by typing 'o conf init' at the cpan prompt.)
    
    Are you ready for manual configuration? [yes]
    
  6. Repeatedly press Enter to continue, accepting each default setting through the following prompts:

    • Are you ready for manual configuration? [yes]
    • CPAN build and cache directory? [/home/username/.cpan]
    • Cache size for build directory (in MB)? [10]
    • Perform cache scanning (atstart or never)? [atstart]
    • Cache metadata (yes/no)? [yes]
    • Your terminal expects ISO-8859-1 (yes/no)? [yes]
    • File to save your history? [/home/username/.cpan/histfile]
    • Number of lines to save? [100]
    • Policy on building prerequisites (follow, ask or ignore)? [ask]
    • Where is your gzip program? [/bin/gzip]
    • Where is your tar program? [/bin/tar]
    • Where is your unzip program? [/usr/bin/unzip]
    • Where is your make program? [/usr/bin/make]
    • Where is your links program? [/usr/bin/links]
    • Where is your wget program? [/usr/bin/wget]
    • Where is your ncftpget program? []
    • Where is your ncftp program? []
    • Where is your ftp program? [/usr/kerberos/bin/ftp]
    • Where is your gpg program? [/usr/bin/gpg]
    • What is your favorite pager program? [/usr/bin/less]
    • What is your favorite shell? [/bin/bash]
  7. Accept any additional defaults until you encounter the following prompt:

    Every Makefile.PL is run by perl in a separate process. Likewise we
    run 'make' and 'make install' in processes. If you have any
    parameters (e.g. PREFIX, LIB, UNINST or the like) you want to pass
    to the calls, please specify them here.
    
    If you don't understand this question, just press ENTER.
    
    Parameters for the 'perl Makefile.PL' command?
    Typical frequently used settings:
    
        PREFIX=~/perl       non-root users (please see manual for more hints)
    
    Your choice:  []
    
  8. Enter PREFIX=~/lib/perl5 LIB=~/lib/perl5/lib INSTALLMAN1DIR=~/lib/perl5/man1 INSTALLMAN3DIR=~/lib/perl5/man3 and press Enter.

  9. Continue to press Enter until you encounter the following prompt:

    Now we need to know where your favorite CPAN sites are located. Push a
    few sites onto the array (just in case the first on the array won't
    work). If you are mirroring CPAN to your local workstation, specify a
    file: URL.
    
    First, pick a nearby continent and country (you can pick several of
    each, separated by spaces, or none if you just want to keep your
    existing selections). Then, you will be presented with a list of URLs of
    CPAN mirrors in the countries you selected, along with previously
    selected URLs. Select some of those URLs, or just keep the old list.
    Finally, you will be prompted for any extra URLs -- file:, ftp:, or
    http: -- that host a CPAN mirror.
    
    (1) Africa
    (2) Asia
    (3) Australasia
    (4) Central America
    (5) Europe
    (6) North America
    (7) Oceania
    (8) South America
    Select your continent (or several nearby continents) []
    
  10. Since WebFaction’s servers are located in the United States, enter 6 and press Enter.

    The following prompt appears:

    Sorry! since you don't have any existing picks, you must make a
    geographic selection.
    
    (1) Bahamas
    (2) Canada
    (3) Mexico
    (4) United States
    Select your country (or several nearby countries) []
  11. Enter 4 and press Enter. Another prompt, listing available CPAN mirrors appears.

  12. Enter 1 2 3 4 5 6 7 8 9 10 and press Enter.

  13. Press Enter to quit the configuration process. The cpan> prompt appears.

  14. Press Ctrl + D to exit.

You can now install CPAN modules. To install a module with cpan, enter cpan install module_name. For example, cpan install Locale::gettext.

Previous topic

Movable Type

Next topic

PHP

Search the documentation

Example: "configure email" or "create database"

Feedback

Send us your feedback on this documentation.