I don't know if this is a CPANTS-only thing, or a real bad example of YAML specs, but as the last run of my just uploaded Spreadsheet::Read in which I included a somewhat more complicated META.yml caused error reports, I'm asking in public
Compare these sections: http://module-build.sourceforge.net/META-spec-current.html#recommends http://module-build.sourceforge.net/META-spec-v1.4.html#recommends http://module-build.sourceforge.net/META-spec-v1.3.html#recommends Current is obviously 1.4, where CPANTS still checks 1.3, which is an easy fix: --8<--- --- Module/CPANTS/Kwalitee/MetaYML.pm.org 2008-08-31 11:56:54.000000000 +0200 +++ Module/CPANTS/Kwalitee/MetaYML.pm 2008-08-31 11:42:29.000000000 +0200 @@ -7,7 +7,7 @@ use Test::YAML::Meta::Version; sub order { 20 } -my $CURRENT_SPEC = '1.3'; +my $CURRENT_SPEC = '1.4'; ################################################################## # Analyse -->8--- Weird entry: http://module-build.sourceforge.net/META-spec-v1.4.html#metaspec --8<--- meta-spec Example: meta-spec: version: 1.4 url: http://module-build.sourceforge.net/META-spec-v1.3.html (Spec 1.1) [required] {URL} This field indicates the location of the version of the META.yml specification used. -->8--- Yeah right. The version is 1.4, but the URL is 1.3 1.4 has this example --8<--- optional_features: foo: description: Provides the ability to blah. requires: Data::Dumper: 0 File::Find: 1.03 -->8--- So I included in my META.yml --8<--- optional_features: CSV: description: Provides parsing of CSV streams requires: Text::CSV_XS: 0.23 recommends: Text::CSV: 1 Text::CSV_PP: 1.05 Text::CSV_XS: 0.52 Excel: description: Provides parsing of Microsoft Excel files requires: Spreadsheet::ParseExcel: 0.26 recommends: Spreadsheet::ParseExcel: 0.33 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 -->8--- Or, with the version currently on CPAN: --8<--- optional_features: - CSV: description: Provides parsing of CSV streams requires: Text::CSV_XS: 0.23 recommends: Text::CSV: 1 Text::CSV_PP: 1.05 Text::CSV_XS: 0.52 - Excel: description: Provides parsing of Microsoft Excel files requires: Spreadsheet::ParseExcel: 0.26 recommends: Spreadsheet::ParseExcel: 0.33 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.3.html version: 1.3 -->8--- The checking code in .../Module/CPANTS/Kwalitee/MetaYML.pm is --8<--- if (grep {/^META\.yml$/} @$files) { eval { open(my $FH,'<',catfile($distdir,'META.yml')) || die "Cannot read META.yml: $!"; my $yml=join('',<$FH>); close $FH; die "I do not want to handle stuff like version: !!perl/hash:version" if $yml=~/ !perl/; $me->d->{meta_yml}=Load($yml); $me->d->{metayml_is_parsable}=1; }; if ($@) { $me->d->{error}{metayml_is_parsable}=$@; return; } } -->8--- And the code I use in my own check is --8<--- if ($check) { use YAML::Syck; my $h; eval { $h = Load (join "", @yml) }; print $@; if ($h && $opt_v) { # I prefer Data::Dumper instead of my $_ = Dump $h; print; } } -->8--- And my YAML is loaded and dumped without problems. --8<--- $ CPAN/Spreadsheet-Read 143 > cpants_lint.pl *tgz Checked dist Spreadsheet-Read-0.27.tgz Kwalitee rating 148.00% (37/25) Ignoring metrics is_prereq, prereq_matches_use, build_prereq_matches_use Here is a list of failed Kwalitee tests and what you can do to solve them: * metayml_conforms_to_known_spec Take a look at the META.yml Spec at http://module-build.sourceforge.net/META-spec-current.html and change your META.yml accordingly Failed optional Kwalitee tests and what you can do to solve them: * metayml_conforms_spec_current Take a look at the META.yml Spec at http://module-build.sourceforge.net/META-spec-current.html and change your META.yml accordingly * has_separate_license_file This is not a critical issue. Currently mainly informative for the CPANTS authors. It might be removed later. * distributed_by_debian Make your package easily repackagable by Debian and convince the Debian-Perl team to package your module -->8--- So I dug deeper, and used Test::YAML::Meta::Version --8<--- Missing mandatory field, 'generated_by' (generated_by) [Validation: 1.0] Missing mandatory field, 'version' (version) [Validation: 1.0] Missing mandatory field, 'name' (name) [Validation: 1.0] Missing mandatory field, 'license' (license) [Validation: 1.0] -->8--- Huh? Look at the dump: --8<--- --- abstract: Meta-Wrapper for reading spreadsheet data author: - H.Merijn Brand <[EMAIL PROTECTED]> build_requires: Test::Harness: 0 Test::More: 0 perl: 5.006 distribution_type: module generated_by: Author license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Read optional_features: CSV: description: Provides parsing of CSV streams recommends: Text::CSV: 1 Text::CSV_PP: 1.05 Text::CSV_XS: 0.52 requires: Text::CSV_XS: 0.23 Excel: description: Provides parsing of Microsoft Excel files recommends: Spreadsheet::ParseExcel: 0.33 requires: Spreadsheet::ParseExcel: 0.26 OpenOffice: description: Provides parsing of OpenOffice spreadsheets requires: Spreadsheet::ReadSXC: 0.2 Tools: description: Spreadsheet tools recommends: Tk: 0 Tk::NoteBook: 0 Tk::TableMatrix::Spreadsheet: 0 provides: Spreadsheet::Read: file: Read.pm version: 0.27 recommends: File::Temp: 0.14 IO::Scalar: 0 requires: Carp: 0 Data::Dumper: 0 Exporter: 0 perl: 5.006 resources: license: http://dev.perl.org/licenses/ version: 0.27 -->8--- All the missing entries are in place, so I pass the version, like --8<--- my $t = Test::YAML::Meta::Version->new ( spec => $h->{"meta-spec"}->{version}, ); $t->parse ($h) and print join "\n", $t->errors, ""; -->8--- And get a different message: --8<--- Expected a map structure from YAML string or file [Validation: 1.4] -->8--- Now *that* looks like something really helpful. At least it parsed using 1.4, not using 1.0 How do I translate the given example in the specs to the requirement in Version.pm? --8<--- 'optional_features' => { list => { ':key' => { name => \&word, 'map' => { description => { value => \&string }, requires_packages => { value => \&string }, requires_os => { value => \&string }, excludes_os => { value => \&string }, requires => $module_map1, recommends => $module_map1, build_requires => $module_map1, conflicts => $module_map2, } } } }, -->8--- -- H.Merijn Brand Amsterdam Perl Mongers http://amsterdam.pm.org/ using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00, 11.11, 11.23, and 11.31, SuSE 10.1, 10.2, and 10.3, AIX 5.2, and Cygwin. http://mirrors.develooper.com/hpux/ http://www.test-smoke.org/ http://qa.perl.org http://www.goldmark.org/jeff/stupid-disclaimers/