Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Dear All

I am learning Perl and need some help with the terminology and the different ways Perl modules can be installed

If I want to install a Perl module manually (without CPAN) on Linix, in what format do I need to download the module. Specifically what is the proper name for this format so I can search for repositories of these modules

If I want to install a Perl module using CPAN, what format must the module be in? Is it just called CPAN format or does it have a specific name?

If I want to install modules using apt-get, what format must be modules be in? I've seen them described as apt-get packages but I don't know if this is the proper name

Lastly, although you may have already answered this question by this point, I am presuming that for manual installation and CPAN you are downloading source code. With a manual installation you have to compile and build it yourself whereas CPAN takes care of those steps for you. Is this right?

  • Comment on Help needed with terminology - different formats of modules

Replies are listed 'Best First'.
Re: Help needed with terminology - different formats of modules
by marto (Cardinal) on Oct 28, 2010 at 15:58 UTC

    Out of curiosity, are you the same AM who posted Very confused about system perl and local perl and path to perl on umbuntu? Have you read Installing Modules from the tutorials section?

    "If I want to install a Perl module manually (without CPAN) on Linix, in what format do I need to download the module. Specifically what is the proper name for this format so I can search for repositories of these modules"

    Download the modules from http://search.cpan.org, each module has it's own page with a download link on the right. Unpack pack them (in ubutnu you can use the Archive Manager as previously discussed). What 'repositories' are you going to search? People have various preferences about how to build their modules. See perlmod. Modules can be pure perl or include other code which needs to be compiled. For this you'll need a compiler. IIRC Ubuntu ships with gcc so you don't need to worry about that. Installing modules manually will mean that you may have to keep going back and installing all the dependences (again, manually). If you install via the CPAN command this can take care of this for you.

    " If I want to install modules using apt-get, what format must be modules be in? I've seen them described as apt-get packages but I don't know if this is the proper name"

    As mentioned in Very confused about system perl and local perl, using apt-get will install to your system perl, doing this defeats the purpose of what you set out to do, which was keep your modules separate. If you want to learn about apt-get, Wikipedia has an entry and links to official documentation.

    " Lastly, although you may have already answered this question by this point, I am presuming that for manual installation and CPAN you are downloading source code. With a manual installation you have to compile and build it yourself whereas CPAN takes care of those steps for you. Is this right?"

    Yes you have to run:

    $HOME/localperl/bin/perl Makefile.PL make make test make install

    If you read the documentation for most modules, they'll tell you how to install them. Again, you may want to consider registering an account here, to keep track of your posts and their responses.

      Yes I've read that tutorial but it doesn't answer any of the questions I have asked in this post. I may have asked other general questions in the past but this is a specific question unrelated to other posts. I hope that's ok

      I wanted to have a go at installing a module manually without CPAN for the experience which is why I asked for the format 'raw' modules come in so I could have find a module and install it. I presume they are just the source code but I don't know if it is correct to say (or search for in google) 'I need the source code of the CGI::Session module'

      Regardless of whether I use CPAN or apt-get to install a module, I would like to know what formats the modules come in for these 2 different tools. I can't discuss my problems with people if I don't know the right terms. I know apt-get uses .deb files but I don't know if it is correct to say something like 'I need the .deb version of a perl module.' Similarly if I don't know if it is correct to say 'I need the CPAN version of a Perl module.' It would also be nice to have a small insight into the different between the CPAN version and the .deb version of a module. I'm not being lazy in asking in a forum. I've spent the past 2 days tirelessly searching the internet but its like finding a needle in a haystack. Most websites simply tell you what to do without giving any insight into what you are doing and why.

      Does that make more sense? I hope so :)

        "Yes I've read that tutorial but it doesn't answer any of the questions I have asked in this post. I may have asked other general questions in the past but this is a specific question unrelated to other posts. I hope that's ok."

        I don't believe you've read this properly then. From A Guide to Installing Modules:

        The Basics of Module Installation

        Most modules are available from CPAN - the Comprehensive Perl Archive Network. They are supplied in what is known as a tarball. A tarball is a gzip compressed tar file. When a module is made the directory structure it lives in is converted to a single file that contains both the files and the directory information. A program called tar performs this function and the resultant file is called a tar file. Tar files have a .tar file extension. This tar file is then compressed using the gzip (GNU Zip) program. Gzipped files have a .gz extension thus a standard module will be called something like:" Some-Module-0.01.tar.gz

        That tutorial then goes on to explain what I've already told you about Modules being pure perl or containing code which needs to be compiled. Which is something you asked about.

        If you want to know what a deb file is, look it up, use Google, read the wikipedia article.

        For clarification, Cpan, the website is essentially dumb storage. The cpan command line utility can be used to fetch,install and upgrade modules, including their dependencies. This is described in the documentation I've linked you to before.

        Think of .deb files as software packages for the Debian (which Ubuntu is based on) operating systems packaging tool (dpkg/apt-get). And the downloads from CPAN as archives for the CPAN tool.

        Once again, if you install a module from a .deb file or via apt-get you are altering the system perl. This install method uses a packaging system for your operating system to make it easy for the OS to be maintained and install other applications. The alternatives have been explained to you several times now, re read your previous posts.

        "I don't know if it is correct to say something like 'I need the .deb version of a perl module.' Similarly if I don't know if it is correct to say 'I need the CPAN version of a Perl module.'"

        Why would you be saying this to anyone? If you wanted to install (a deb file) via apt-get it would fetch it automatically for you from your systems configured software sources. If you want to install your own module from source http://search.cpan.org is the place to go looking. I think you're confusion stems from the following:

        • You're new to linux
        • You don't understand package management
        • You're new to Perl

        These aren't criticisms. I believe these are just the things you need to become acquainted with in order to understand what you want to know at a level you seem to want to understand it.

        "I can't discuss my problems with people if I don't know the right terms."

        If you have a DBI problem, that's what you say to people. "I have a problem with fetching records from Oracle using DBI". IMHO most of the time your problems wont be dependant on how you installed a module.

        Update: Added last sentence.

Re: Help needed with terminology - different formats of modules
by ikegami (Patriarch) on Oct 28, 2010 at 16:41 UTC

    Noone mentioned that cpan installs dependencies.

    cpan does

    • Download the tarball
    • Extract the tarball
    • perl Makefile.PL
    • Install dependencies
    • make
    • make test
    • make install

    (If Build.PL is present, cpan uses the installation procedure for a Module::Build module instead.)

Re: Help needed with terminology - different formats of modules
by jethro (Monsignor) on Oct 28, 2010 at 16:37 UTC

    The CPAN format is normal tar.gz files, i.e. files that are packed together with tar and then compressed with gzip. How to install them manually is explained in http://www.cpan.org/modules/INSTALL.html.

    You don't need to search for repositories, because you can just download the packages from CPAN. For example if you go to http://search.cpan.org, type CGI into the search field and then click on CGI::Minimal, you will find a link to the package on the right side under "Download:"

    If you download it, decompress and unpack it, you will find inside the top directory a file README, with the following contents:

    CGI::Minimal An _extremely_ lightweight CGI processing package designed to provide form decoding and related services with low overhead. To install: perl Makefile.PL make make test make install Alternatively, if you have Module::Build installed, perl Build.PL ./Build ./Build test ./Build install See 'perldoc CGI::Minimal' for the documentation.

    And what the CPAN shell does is the above, just automated (complete with download). If it is pure perl essentially nothing else than some copying of module files to their proper place under /usr/lib/perl5 (or /usr/local/lib/perl5 or ...) happens. If there are C-sources included, those have to be compiled, but 'make' does that automatically for you

    If you install with apt-get, the compilation of C-sources was already done for you. The format is called rpmdeb and is in essence the packed and compressed files and information where the files have to be stored.

    PS: When you say "I want to install without CPAN", do you mean without the automatic shell that is started when you type in "cpan" or do you mean without accessing this central repository that is called CPAN? The first is easy to do even though it removes much of the comfort of using perl. The second is impossible because CPAN is just THE central and exclusive repository for perl. There are some bigger packages that have their own website and might even allow download separate from CPAN, but that's not the common case

Re: Help needed with terminology - different formats of modules
by Monkomatic (Sexton) on Oct 28, 2010 at 16:57 UTC

    "If I want to install a Perl module manually (without CPAN) on Linix, in what format do I need to download the module. Specifically what is the proper name for this format so I can search for repositories of these modules"

    They are usually in a compressed format. You will need to decompress them first before install.

    One of my favorites (example) (thank you Gisle Aas and Martijn Koster) libwww-perl-5.837.tar.gz

    "If I want to install a Perl module using CPAN, what format must the module be in? Is it just called CPAN format or does it have a specific name?"

    CPAN is the depository where they are held. CPAN also has a handy dandy helpfull installer program. Which is also called CPAN which probably is your best bet to get these things installed

    http://search.cpan.org/~andk/CPAN-1.9402/lib/CPAN.pm

    without doing the below.

    $HOME/localperl/bin/perl Makefile.PL make make test make install

    Which just to let you know in advance can get messy since they are also dependent upon other installs. You may need some help if you choose this route.

    "If I want to install modules using apt-get, what format must be modules be in? I've seen them described as apt-get packages but I don't know if this is the proper name"

    I believe they are all in Tar.gz

    "Lastly, although you may have already answered this question by this point, I am presuming that for manual installation and CPAN you are downloading source code. With a manual installation you have to compile and build it yourself whereas CPAN takes care of those steps for you. Is this right? "

    yes