Debian Perl FAQ

Perl is used quite extensively in Debian. Not only are some core functions written in Perl, but there are over 700 packages in unstable that have perl in their name (Mar 2004).


Dpkg, Perl and CPAN

http://www.cpan.org/

Searching the Comprehensive Perl Archive Network (CPAN) can be as much of a candy-store experience as searching the Debian packages for software. CPAN provides a way for Perl developers to distribute their work in an organized fashion that includes user feedback.

Before you take the plunge and run perl -MCPAN -e shell, consider what the effects of your actions will be on your nice dpkg system. Installing directly from CPAN into usr/lib/perl will mean you are mixing dpkg managed files with CPAN managed files, and most likely the dependencies of dpkg will never be the same.

The way Debian's Perl package in Sarge is configured CPAN works just fine. The Debian Perl package defines siteprefix as /usr/local and sitelib as /usr/local/share/perl/5.8.4 and sitearch as /usr/local/lib/perl/5.8.4. Because of this if you use CPAN and take the default settings your extra stuff from CPAN goes into the right places in /usr/local.

dh-make-perl

Enter dh-make-perl . This debhelper program handles the Debianizing process of Perl modules from CPAN.

 dh-make-perl --build --cpan Perl::Tidy

This will make a Debian package in the current directory for installing the Perl::Tidy module. Installing the package will update the dpkg database and keep your package dependencies in order.

You will still need to use discretion when choosing packages to build and install. For example, while you could use dh-make-perl to build CGI::Kwiki, a DebianDeveloper is already maintaining this package ( Kwiki ) and is most likely doing a better job than this automated build will do. Plus the bug tracking system (BTS) is in place.

If the module isn't available for your release or isn't available at all, dh-make-perl away.

per-user Perl modules

If you don't have system install privileges, or if you don't care about making site-wide installs of the perl modules, you could use CPAN and install into ~/perl.

The [http://search.cpan.org/~jhi/perl-5.8.0/lib/CPAN.pm CPAN.pm documentation] has this advice for using CPAN into ~/perl:

When the CPAN module is installed, a site wide configuration file is created as CPAN/Config.pm. The default values defined there can be overridden in another configuration file: CPAN/!?MyConfig.pm. You can store this file in $HOME/.cpan/CPAN/!?MyConfig.pm if you want, because $HOME/.cpan is added to the search path of the CPAN module before the use() or require() statements.

5) I am not root, how can I install a module in a personal directory?

You will most probably like something like this:

  o conf makepl_arg "LIB=~/myperl/lib \
                    ["INSTALLMAN1DIR"]=~/myperl/man/man1 \
                    ["INSTALLMAN3DIR"]=~/myperl/man/man3"
  install Sybase::Sybperl

You can make this setting permanent like all o conf settings with o conf commit.

You will have to add ~/myperl/man to the MANPATH environment variable and also tell your perl programs to look into ~/myperl/lib, e.g. by including

  use lib "$ENV{HOME}/myperl/lib";

or setting the ["PERL5LIB"] environment variable.

Another thing you should bear in mind is that the UNINST parameter should never be set if you are not root.


Running a different version of Perl in usr/local

/What about installing into usr/local?/

This should work similarly to the tips on running out of $HOME, with the advantage of possibly already having /usr/local/lib/perl/<version> in your @INC. Look for /usr/lib/*/Config.pm to see how your /usr/bin/perl is configured.

/What if you want to install an updated version of perl in usr/local for experimental work but keep the Debian/Release version in usr?/ This setup may not work out well with the Debian Perl package for Sarge since it has it's own ideas about Perl stuff in /usr/local.


How can I make my @INC path more dynamic

If you have your Perl module (.pm) files in the same directory or same relative directory from your Perl program files (aka scripts ) then ?FindBin may be the package for you.

If you want to not force a directory structure depenancy on your program and libs but you aren't using /usr/lib/perl for your libs, try these tricks:

Program reads a config file in the same directory using open()

 #! /usr/bin/perl
 BEGIN {
   open(CONF,"libconf");
   my $l = <CONF>;
   close(CONF);
   chomp($l); #remove trailing LF
   require lib;
   lib->import($l);
  }

 -- config --
 /my/libs/path

Program requires a local config script.

 #! /usr/bin/perl
 BEGIN {
    require ".uselib.pl";
 }

 -- .uselib.pl --
 # Local setting overrides for program
 use lib qw( /my/libs/path );
 # You can define a uselib package and some
 # variables to export here
 1;


Communicating about Perl on Debian

One of the first places to go to see what the state of Perl is on Debian, or to review past discussions, would be the debian-perl list. http://lists.debian.org/debian-perl/

The dh-make-perl package is on Alioth at http://alioth.debian.org/projects/dh-make-perl/.

There is a Debian Perl group, also managed on Alioth at http://alioth.debian.org/projects/pkg-perl/. Their goal is to do quality assurance (QA) work for the perl modules in Debian.


Perl package Spotlight

SpamAssassin

This impressively effective email scoring tool uses Perl's regexp power to it's fullest. It also allows other programs to be plugged into it, increasing it's flexibility and power. SpamAssassin

Kwiki (of course)

A Quickie Wiki that's not too Tricky. You're experiancing Kwiki right now if you're viewing this page at wiki.debian.net. Kwiki


Current know issues

Please share known issues and experiences here. [http://www.etoo.cn/sports 健身器材] [http://www.etoo.cn/stadium 场馆设备] [http://www.etoo.cn/21win-win 拓展训练] [http://www.paite.net 尖锐湿疣] [http://www.paite.net/1 尖锐湿疣] [http://www.paite.net/default.asp 尖锐湿疣] [http://www.wjmgy.com 脉管炎] [http://www.wjmgy.com/1 脉管炎] [http://www.wjmgy.com/hospitaljs.htm 脉管炎] [http://www.wjmgy.com/zhuankejs.htm 脉管炎] [http://www.wjmgy.com/zhuzhiys.htm 脉管炎] [http://www.wjmgy.com/conact.htm 脉管炎]