Perl Package Management

From AdminWiki

(Difference between revisions)
Jump to: navigation, search
(debian.)
(RedHat)
 
Line 17: Line 17:
When building rpms, you should at least specify the --packager option. Or just put it in your $HOME/.cpan2rpm file (you should build your [http://www.redhat.com/archives/rpm-list/2001-March/msg00413.html rpms as non-root]).
When building rpms, you should at least specify the --packager option. Or just put it in your $HOME/.cpan2rpm file (you should build your [http://www.redhat.com/archives/rpm-list/2001-March/msg00413.html rpms as non-root]).
 +
 +
To install a package Foo::Bar after building and fetching it from CPAN:
 +
cpan2rpm --install Foo::Bar
 +
 +
To pass an option of "-l" to Makefile.PL, use --make-maker:
 +
cpan2rpm --install --make-maker "-l" Foo::Bar

Latest revision as of 01:47, 27 May 2006

It's important that you have an complete overview over which perl modules are installed on a server, in case that you ever need to migrate the setup. The package manager of your OS is a good facility, given that it has a consistent naming style for perl modules.

Linux

Debian

Most modules are already packaged. Given a module-name of Foo::Bar

apt-cache search foo bar perl

should be able to find it. If it isn't available, install dh-make-perl and then run

dh-make-perl --install --cpan Foo::Bar

to automatically fetch the sources, build the module, create the package and install it.

RedHat

On older versions of RedHat, you could use cpanflute or cpanflute2, which was usually included in either the rpm.rpm or some rpm-devel.rpm. On newer versions, you should use cpan2rpm.

cpan2rpm can be installed by rebuilding the source rpm. You will also need Module::Build, which is unfortunately not available as an RPM on RHEL. Instead you can either install it from some source rpm, or build it yourself using cpan2rpm on another machine, or just install it from CPAN (and remove it after building it with cpan2rpm).

When building rpms, you should at least specify the --packager option. Or just put it in your $HOME/.cpan2rpm file (you should build your rpms as non-root).

To install a package Foo::Bar after building and fetching it from CPAN:

cpan2rpm --install Foo::Bar

To pass an option of "-l" to Makefile.PL, use --make-maker:

cpan2rpm --install --make-maker "-l" Foo::Bar
Personal tools