Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What modules are distributed with Perl?

Tags:

module

perl

How do I know what modules are distributed with Perl?

My first guess is that the core modules listed here are always included, though I cannot find this stated explicitly. However, I have used modules outside this set (e.g. LWP) without having to install them on Mac OS X and Linux.

So to refine my question a little:

  • What modules are distributed with all Perl installations?

And: How do I find out what modules have been distributed with:

  • Linux (particularly Debian/Ubuntu)?

  • Mac OS X?

  • Solaris?

In each case I am using the version of Perl that comes standard with the most recent version of the operating system.

TIA.

Update: The reason for the question is that I am developing on Mac OS X and Linux for deployment to different Linux and Solaris, and I don't have root on some of these systems, and in the case of Mac OS X I don't even have a compiler AFAIK. So what I want to know what modules I have available in all four deployments without further installs.

like image 219
Anon Gordon Avatar asked Feb 20 '09 23:02

Anon Gordon


People also ask

How many Perl modules are there?

Perl modules are a set of related functions in a library file. They are specifically designed to be reusable by other modules or programs. There are 108,000 modules ready for you to use on the Comprehensive Perl Archive Network.

What is a Perl distribution?

In Perl a true value is any value that is not: null, zero or a zero-length string. A distribution is a collection of files that usually includes a Perl module and several other files.

Where does Perl look for modules?

Whatever the case, Perl gives you options to manage where it looks for modules. Suppose you have a program in your ~/work directory that uses a module named Site::User . By default, Perl will search all of the directories in the special @INC variable for a file named Site/User.pm.


2 Answers

If you install Module::CoreList, the command line program corelist can tell you everything about modules and their versions in different versions of perl. The page you linked to gives an overview for the latest version of perl.

Do note that distributions often provide much more by default than this list, but this list can be assumed to be present everywhere (unless it is explicitly a OS dependent module such as Win32).

like image 144
Leon Timmermans Avatar answered Sep 28 '22 05:09

Leon Timmermans


The correct straight forward answers have already been given, but I think you've asked the wrong question. You're probably trying to develop using only core modules. Why? You're probably doing this because you don't want to deal with dependencies. Why? Because they can be a pain in the ass. But developing Perl without CPAN is missing half the power. You're crippling yourself. It's worth it.

Update: Now that I know more about what you're trying to do, I can answer the right question. First is "how do I install a module when I don't have root?" The simple answer is this:

perl Makefile.PL PREFIX=/some/path LIB=/some/path/lib
...and all the rest as normal...

for MakeMaker based modules (LIB is used to control the otherwise inexact nature of PREFIX. INSTALL_BASE is preferred, but it is not backwards compatible).

and this for Module::Build

perl Build.PL --install_base=/some/path

and then modules will wind up in /some/path/lib and you can set the PERL5LIB environment variable or use lib qw(/some/path/lib) in your code.

This means you can stick dependent modules straight into your software distribution and ship them. Works fine for pure-Perl modules. For stuff that requires a compiler, look at PAR as others have suggested to be able to ship compiled executables.

Alternatively, you can distribute your stuff as a CPAN module, complete with dependencies spelled out, and let a CPAN client resolve them. You can even use Module::AutoInstall to perform this process outside of a CPAN client.

So you see, you're not restricted to using just core modules when shipping a Perl app.

like image 44
2 revs Avatar answered Sep 28 '22 03:09

2 revs