Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Auto-Installing Modules

by Nitrox (Chaplain)
on Oct 30, 2002 at 17:50 UTC ( #209171=perlquestion: print w/replies, xml ) Need Help??

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

I have an application I've written for WIN32 that requires the end-user to install certain modules before use. I'd like to make the install process as painless as possible by finding a way to 'auto-install' the needed modules.

For example, if the 'install' script needs WIN32::SomeModule then I can catch 'use' errors and install the module (assuming an internet connection and it existing in the PPM repository) with:

BEGIN { unless(eval "use Win32::SomeModule") { warn "Couldn't load Win32::SomeModule"; print `ppm install Win32::SomeModule`; } }
But will a subsequent 'use Win32::SomeModule' fail also since the interpreter is already running with the library collection that existed at the time of execution?

Furthermore, if I'm aware that a required module is not available in a PPM repository, has anyone experimented with auto downloading/compiling/installing from CPAN?

If a node already exists on this subject please point me to the proper place, thanks!

-Nitrox

Replies are listed 'Best First'.
Re: Auto-Installing Modules
by valdez (Monsignor) on Oct 30, 2002 at 18:42 UTC

    I didn't try it, but I found ExtUtils::AutoInstall:

    ExtUtils::AutoInstall lets module writers to specify a more sophisticated form of dependency information than the PREREQ_PM option offered by ExtUtils::MakeMaker.

    This module is part of OpenThought and uses CPANPLUS or CPAN to download and install selected modules. With this solution you still need to install some modules before running your installation script... but at least you can borrow some ideas from it :)

    Ciao, Valerio

Re: Auto-Installing Modules
by Nitrox (Chaplain) on Oct 30, 2002 at 22:07 UTC
    The application is a 'stand-alone' script and isn't a module itself, so there isn't a 'true' install in the sense of 'perl Makefile.PL', etc.

    The 'install script' would be just something to run command line and would automate the install of the required modules.

    -Nitrox

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2023-11-30 04:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?