NAME
ExtUtils::AutoInstall - Automatic installation of CPAN dependencies
SYNOPSIS
in Makefile.PL:
use ExtUtils::MakeMaker;
use ExtUtils::AutoInstall (
'' => [
# core modules
Package1 => '0.01',
],
'Feature1', [
# do we want to install this feature by default?
sub { system('feature1 --version') == 0 },
Package2 => '0.02',
],
'Feature2', [
# skips checking -- defaults to install
Package3 => '0.03',
],
);
WriteMakefile(
AUTHOR => 'Joe Hacker (joe@hacker.org)',
ABSTRACT => 'Perl Interface to Joe Hacker',
NAME => 'Joe::Hacker',
VERSION_FROM => 'Hacker.pm',
DISTNAME => 'Joe-Hacker',
PREREQ_PM => PREREQ_PM, # <== ADD THIS
);
DESCRIPTION
ExtUtils::AutoInstall lets module writers specify a more sophisticated form of dependency information than MakeMaker's PREREQ_PM
option.
Existingrequisites are grouped into features, and the user could specify yes/no on each one. The module writer may also supply a test subroutine reference to determine the default choice.
The Core Features marked by an empty feature name is an exeption: all missing packages that belongs to it will be installed without prompting the user.
Once ExtUtils::AutoInstall knows which modules are needed, it checks whether it's running under the CPAN shell and should let CPAN handle the dependency. If not so, a separate CPAN instance is created to install the required modules.
CAVEATS
Since this module is needed before writing Makefile, it makes little use as a CPAN module; hence each distribution must include it in full. The only alternative I'm aware of, namely prompting in Makefile.PL to force user install it (cf. the Template Toolkit's dependency on AppConfig) is not very desirable either.
If you have any solutions, please let me know. Thanks.
AUTHORS
Autrijus Tang <autrijus@autrijus.org>
COPYRIGHT
Copyright 2001 by Autrijus Tang <autrijus@autrijus.org>.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.