use
5.008_001;
our
$VERSION
=
'0.11'
;
sub
merge_meta_with_cpanfile {
my
$self
=
shift
;
my
$file
= Module::CPANfile->load;
if
(
$self
->is_admin) {
CPAN::Meta->load_file(
'META.yml'
)->save(
'META.json'
);
print
"Regenerate META.json and META.yml using cpanfile\n"
;
$file
->merge_meta(
'META.yml'
);
$file
->merge_meta(
'META.json'
);
}
for
my
$metafile
(
grep
-e,
qw(MYMETA.yml MYMETA.json)
) {
print
"Merging cpanfile prereqs to $metafile\n"
;
$file
->merge_meta(
$metafile
);
}
}
sub
cpanfile {
my
(
$self
,
%options
) =
@_
;
$self
->include(
"Module::CPANfile"
);
$self
->configure_requires(
"CPAN::Meta"
);
$self
->dynamic_config(0)
unless
$options
{dynamic};
my
$write_all
= \&::WriteAll;
*main::WriteAll
=
sub
{
$write_all
->(
@_
);
$self
->merge_meta_with_cpanfile;
};
$self
->include(
"Module::CPANfile"
);
$self
->configure_requires(
"CPAN::Meta"
);
if
(
$self
->is_admin) {
my
$prereqs
= Module::CPANfile->load->prereqs;
my
@err
= CPAN::Meta::Check::verify_dependencies(
$prereqs
, [
qw/runtime build test develop/
],
'requires'
);
for
(
@err
) {
warn
"Warning: $_\n"
;
}
}
else
{
warn
"CPAN::Meta::Check is not installed. Skipping dependencies check for the author.\n"
;
}
}
}
1;