Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

How can I programmatically install a module from file.

by jeteve (Pilgrim)
on Feb 01, 2006 at 09:14 UTC ( #527002=perlquestion: print w/ replies, xml ) Need Help??
jeteve has asked for the wisdom of the Perl Monks concerning the following question:

Hi Wise monks.

Currently, I got an entire collection of perl modules I have to install on a machine that have no access to the internet, so I cannot use CPAN with a bundlestyle module.

These modules are tarballs in a directory. How can I write a little perl program to install all of them ? The order of installation is given in a file.

Can I use the CPAN module to achieve that ? or do I need to do 'tar xzf - ; cd - ; perl Makefile.PL ; make ; make test ; make install ; cd .. ' within an horrible shell command ?

Thanx for your lights.

-- Nice photos of naked perl sources here !

Comment on How can I programmatically install a module from file.
Re: How can I programmatically install a module from file.
by svenXY (Deacon) on Feb 01, 2006 at 09:39 UTC
Re: How can I programmatically install a module from file.
by vishi83 (Pilgrim) on Feb 01, 2006 at 10:31 UTC

    See ExtUtils::Install , ExtUtils::Installed

    But for me manually installing the perl modules using
    perl Makefile.PL make make test make install
    is much better method.
    A perl Script without 'strict' is like a House without Roof; Both are not Safe;
Re: How can I programmatically install a module from file.
by xdg (Monsignor) on Feb 01, 2006 at 10:46 UTC

    While it's not the answer to the question you asked, per se, on the topic of offline installation of perl modules, CPAN can take a file: URL for offline installation. The catch is that the distributions must be in directories structured like CPAN and with the kind of index that CPAN uses.

    For that, you might want to explore CPAN::Mini, which gives you a local mirror of a subset of CPAN which is fairly compact (e.g. CD-ROM or USB-key sized). CPAN::Mini::Inject allows you to add your own distributions to that mirror if you need them.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: How can I programmatically install a module from file.
by blazar (Canon) on Feb 01, 2006 at 12:28 UTC
    Can I use the CPAN module to achieve that ? or do I need to do 'tar xzf - ; cd - ; perl Makefile.PL ; make ; make test ; make install ; cd .. ' within an horrible shell command ?

    At the very worst you can conjure up a quick shell or perl script to do that for every module:

    $ for m in *.tar.gs; do what; I; want; to $m; done
Re: How can I programmatically install a module from file.
by glasswalk3r (Pilgrim) on Feb 01, 2006 at 13:30 UTC

    While CPAN::Mini looks like to do the same thing (and easier, but I need to test it before telling!) you can do the following:

    1. From a Internet connected machine, use the CPAN module and download all the modules that you need.
    2. Create a bundle with those modules
    3. Copy the entire CPAN directory to the offline machine and the Bundle file that you created
    4. Edit the CPAN module configurations telling it to use a file: as the repository, giving it the location of the CPAN directory that you just copied
    5. Install everyting using the bundle you had created
    Alceu Rodrigues de Freitas Junior
    ---------------------------------
    "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://527002]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2014-09-20 02:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (151 votes), past polls