CPAN::AutoINC - Download and install CPAN modules upon first use


CPAN-AutoINC documentation  | view source Contained in the CPAN-AutoINC distribution.

Index


NAME

Top

CPAN::AutoINC - Download and install CPAN modules upon first use

SYNOPSIS

Top

perl -MCPAN::AutoINC <script>

ABSTRACT

Top

When CPAN::AutoINC is loaded, it will add itself to @INC and catch any requests for missing resources. If a Perl module is requested CPAN will be queried and, assuming that the module exists on CPAN, CPAN::Shell will be invoked to install it. Execution of the script continues after the requisite module has been installed.

DESCRIPTION

Top

CPAN::AutoINC is a slightly useful tool designed to streamline the process of installing all of the modules required by a script. By loading the CPAN::AutoINC module (usually via a "-MCPAN::AutoINC" command-line option), the user is registering a handler that will catch any attempt to use a module that does not exist on the local machine. In this case, the CPAN::Shell module will be invoked to search for the specified module and, if found, an attempt will be made to install the module. If successful, the module will be loaded and execution will continue as normal.

For example:

perl -MCPAN::AutoINC -MLingua::Num2Word=cardinal -le 'print cardinal("en", 42)'

...will download and install Lingua::Num2Word and Lingua::EN::Num2Word.

perl -MCPAN::AutoINC -MLingua::Num2Word=cardinal -le 'print cardinal("de", 42)'

...will then download and install Lingua::DE::Num2Word (German).

perl -MCPAN::AutoINC -MLingua::Num2Word=cardinal -le 'print cardinal("es", 42)'

...will then download and install Lingua::ES::Numeros (Spanish).

CAVEATS

Top

MOTIVATION

Top



The description for the Acme::RemoteINC CPAN module ("Slowest Possible Module Loading") prompted me to write this module. The only thing slower than loading precompiled modules via FTP is loading module source code from FTP and compiling it. Except maybe carrier pigeons.

As you can see from the CAVEATS section, there is a fair amount of set-up work required and it will not work for all modules. This makes it relatively useless, especially in a production environment. But it's a cool hack, and could potentially be useful under very limited circumstances.

AUTHOR

Top



Don Schwarz, <don@schwarz.name>

COPYRIGHT AND LICENSE

Top


CPAN-AutoINC documentation  | view source Contained in the CPAN-AutoINC distribution.