Managing Perl
Any Unix distribution will come with perl installed.
Hilary has a bunch of
perl info she needs to move over here, where it will be much easier to play with and reorg, but until then, here's the critical info...
Bootstrapping Perl
[edit]
We use yum to bootstrap a perl installation on a fedora machine, as follows (these are just brief notes, you are welcome to do this on your own fedora machine, however if doing this for the first time on a lab machine and unfamiliar with the tools, ask for help.)
- use yum to install perl, perl-libs, and perl-CPAN (the CPAN module, or MCPAN). You may have to install some dependencies to install these modules.
- switch to MCPAN, 'perl -MCPAN -e shell' (not 'sudo perl -MCPAN -e shell'), configure to run make under sudo
- use MCPAN to install the CPANPLUS module, or MCPANPLUS
- now you should use CPANPLUS as the default package manager for perl modules ('cpanp'). Only use yum when CPANPLUS fails.
- It should be possible to use yum-versionlock to get around this better... (edit /etc/yum.conf and add any modules that you installed using yum in step 1 to the exclude list so that yum does not update them, overwriting newer versions installed by cpanp, space delimited. Example exclude line in yum.conf:
=exclude=perl-* httpd*=)
You can still use yum to list, etc., a module that depends on modules managed by cpan or cpanplus using the --disableexcludes option. However, you will not be able to update them using yum because yum has no --nodeps option. You can update them from source or, if the module is not a perl module, you can use rpm --nodeps to update it. (If the module is a perl module, you cannot use rpm --nodeps as it would not update the perl package inventory.)
Juggling multiple package managers is frustrating. mcpan recognizes when another package manager has touched a file, but yum did not as of 3.2.8.
I've just upgraded to fedora 9 and am exploring the yum plugins to see what I can do with them.
As above, invoke MCPANPLUS as 'cpanp', not 'sudo cpanp'. This ability of MCPANPLUS is very helpful, as many test suites cannot be effectively run with superuser priviledges. cpanp also has the ability to uninstall modules.
Optional modules you will want to install include: Storable, YAML::Tiny, Bundle::CPANPLUS::Test::Reporter, Crypt::OpenPGP
[back to top]
Perl's package managers: cpan and cpanp
[edit]
Perl has its own package managers (see
BootstrappingPerl), which should be used in preference to rpm or yum. There are two interfaces (modules) in use right now - a lower layer of abstraction, the CPAN module (MCPAN) and a higher layer of abstraction, the CPANPLUS module (MCPANPLUS) to which the community is migrating, slowly. It's part of a larger migration to 'pure perl' based on a new module abstraction layer (Module::Build). In any case, you should use cpanp for most things, however, for some things you will still need to fall back to perl -MCPAN -e shell.
Some hints about using cpanp.
- use 's reconfigure' to configure cpanp to your taste. I like setting the interface to 'classic', which makes it behave a lot like MCPAN, which is what I am used to.
- you will need to use 'l Whatever::Module' to check if a module is installed, as 'm Whatever::Module' does not have the cool = marker to show whether a module is installed or not like the listing on MCPAN.
- if you are having trouble installing a package, it may be that header files needed to compile the packages are missing from the system. Some linux distributions (redhat/fedora does this) distinguish between production and development versions of packages. If there's an error message that says can't find foobar.h, or no such file foobar.h, install the -devel package that provides foobar.h
[back to top]
[see also ServerAdminGuidelines]