#! perl
my
(
$help
,
$dry_run
,
$quiet
,
$version
);
my
$options
= GetOptions(
"help"
=> \
$help
,
"dry-run"
=> \
$dry_run
,
"quiet"
=> \
$quiet
,
"version"
=> \
$version
,
);
my
@paths
=
@ARGV
;
my
$script_path
= $0;
my
$script_name
= fileparse
$script_path
;
if
(
defined
$version
) {
die
"$script_name v$Perl::PrereqInstaller::VERSION\n"
;
}
my
$usage
=
<<EOF;
Usage: $script_name FILE_OR_DIR [FILE_OR_DIR ...]
-h, --help
-d, --dry-run
-q, --quiet
-v, --version
EOF
die
$usage
if
defined
$help
;
die
$usage
if
scalar
@paths
== 0;
my
$installer
= Perl::PrereqInstaller->new;
$installer
->quiet(1)
if
$quiet
;
$installer
->scan(
@paths
);
$installer
->report(
{
'not_installed'
=> 1,
'previously_installed'
=> 1,
'newly_installed'
=> 0,
'failed_install'
=> 0,
'scan_errors'
=> 1,
'scan_warnings'
=> 0,
}
);
exit
if
$dry_run
;
$installer
->cpanm;
my
@results
= (
$installer
->newly_installed,
$installer
->failed_install );
print
"\n"
if
scalar
@results
;
$installer
->report(
{
'not_installed'
=> 0,
'previously_installed'
=> 0,
'newly_installed'
=> 1,
'failed_install'
=> 1,
'scan_errors'
=> 0,
'scan_warnings'
=> 0,
}
);
exit
;