Subject: | downgrade_optional_features causes illegal internat structures |
When the original YAML looks like
optional_features:
opt_csv:
description: Provides parsing of CSV streams
requires:
Text::CSV_XS: 0.69
recommends:
Text::CSV: 1.21
Text::CSV_PP: 1.29
Text::CSV_XS: 0.95
opt_excel:
description: Provides parsing of Microsoft Excel files
requires:
Spreadsheet::ParseExcel: 0.26
Spreadsheet::ParseExcel::FmtDefault: 0
recommends:
Spreadsheet::ParseExcel: 0.59
⋮
The internal structure will look like
{ opt_csv => {
description => 'Provides parsing of CSV streams',
x_recommends => {
'Text::CSV' => '1.21',
'Text::CSV_PP' => '1.29',
'Text::CSV_XS' => '0.95'
},
x_requires => {
'Text::CSV_XS' => '0.69'
}
},
opt_excel => {
description => 'Provides parsing of Microsoft Excel files',
x_recommends => {
'Spreadsheet::ParseExcel' => '0.59'
},
x_requires => {
'Spreadsheet::ParseExcel' => '0.26',
'Spreadsheet::ParseExcel::FmtDefault' => 0
}
},
⋮
Passing the complete meta structure through
my $yml = CPAN::Meta::Converter->new ($jsn)->convert (version =>
"1.4");
will now cause several errors like
Odd number of elements in anonymous hash at /pro/lib/perl5/
site_perl/5.16.0/CPAN/Meta/Converter.pm line 462.
followed by
Failed to downconvert metadata to 1.4. Errors:
Expected a map structure from string or file. (optional_features ->
opt_csv -> build_requires) [Validation: 1.4]
Expected a map structure from string or file. (optional_features ->
opt_csv -> requires) [Validation: 1.4]
Expected a map structure from string or file. (optional_features ->
opt_excel -> build_requires) [Validation: 1.4]
Expected a map structure from string or file. (optional_features ->
opt_excel -> requires) [Validation: 1.4]
⋮
Caused in function _downgrade_optional_features
by
$features->{$name} = {
description => $origin->{$name}{description},
requires => _extract_prereqs($origin->{$name}
{prereqs},'runtime','requires'),
configure_requires => _extract_prereqs($origin->{$name}
{prereqs},'runtime','configure_requires'),
build_requires => _extract_prereqs($origin->{$name}
{prereqs},'runtime','build_requires'),
recommends => _extract_prereqs($origin->{$name}
{prereqs},'runtime','recommends'),
conflicts => _extract_prereqs($origin->{$name}
{prereqs},'runtime','conflicts'),
};
resulting in _extract_prereqs () returning empty lists causing illegal
initialisation