Update CPAN-Meta to CPAN version 2.112150
authorChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Wed, 3 Aug 2011 08:17:26 +0000 (09:17 +0100)
committerChris 'BinGOs' Williams <chris@bingosnet.co.uk>
Wed, 3 Aug 2011 08:17:26 +0000 (09:17 +0100)
  [DELTA]

  2.112150  2011-08-02 22:25:41 America/New_York

  [BUGFIX]

  - Stringify any objects encountered during conversion. (RT #67295)

  - Fixed some broken URLs in documentation and for LGPL in legacy
    conversion (RT #68738)

  - Fixed invalid private Pod in CPAN::Meta::Validator (RT #65925)

  [SPEC]

  - Clarified that file paths in the 'provides' section must be in
    Unix-style (i.e. forward slashes) (RT #69045)

  - Replaced examples using Module::Build::ModuleInfo with Module::Metadata
    (RT #66135)

Porting/Maintainers.pl
cpan/CPAN-Meta/Changes
cpan/CPAN-Meta/lib/CPAN/Meta.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Converter.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Feature.pm
cpan/CPAN-Meta/lib/CPAN/Meta/History.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Spec.pm
cpan/CPAN-Meta/lib/CPAN/Meta/Validator.pm
cpan/CPAN-Meta/t/converter.t
pod/perldelta.pod

index d5a77b5..728d6b4 100755 (executable)
@@ -493,7 +493,7 @@ use File::Glob qw(:case);
     'CPAN::Meta' =>
        {
        'MAINTAINER'    => 'dagolden',
-       'DISTRIBUTION'  => 'DAGOLDEN/CPAN-Meta-2.110930.tar.gz',
+       'DISTRIBUTION'  => 'DAGOLDEN/CPAN-Meta-2.112150.tar.gz',
        'FILES'         => q[cpan/CPAN-Meta],
        'EXCLUDED'      => [
                                qr/^xt/,
index e155cc3..f91f71d 100644 (file)
@@ -1,5 +1,24 @@
 Revision history for CPAN-Meta
 
+2.112150  2011-08-02 22:25:41 America/New_York
+
+  [BUGFIX]
+
+  - Stringify any objects encountered during conversion. (RT #67295)
+
+  - Fixed some broken URLs in documentation and for LGPL in legacy
+    conversion (RT #68738)
+
+  - Fixed invalid private Pod in CPAN::Meta::Validator (RT #65925)
+
+  [SPEC]
+
+  - Clarified that file paths in the 'provides' section must be in
+    Unix-style (i.e. forward slashes) (RT #69045)
+
+  - Replaced examples using Module::Build::ModuleInfo with Module::Metadata
+    (RT #66135)
+
 2.110930  2011-04-02 23:31:24 America/New_York
 
   [BUGFIX]
index 5d53514..36f26d8 100644 (file)
@@ -2,10 +2,7 @@ use 5.006;
 use strict;
 use warnings;
 package CPAN::Meta;
-BEGIN {
-  $CPAN::Meta::VERSION = eval '2.110930_001';
-}
-# ABSTRACT: the distribution metadata for a CPAN dist
+our $VERSION = '2.112150'; # VERSION
 
 
 use Carp qw(carp croak);
@@ -15,9 +12,7 @@ use CPAN::Meta::Converter;
 use CPAN::Meta::Validator;
 use Parse::CPAN::Meta 1.4400 ();
 
-sub _dclone {
-    CPAN::Meta::Converter::_dclone(@_);
-}
+BEGIN { *_dclone = \&CPAN::Meta::Converter::_dclone }
 
 
 BEGIN {
@@ -339,6 +334,8 @@ sub TO_JSON {
 
 1;
 
+# ABSTRACT: the distribution metadata for a CPAN dist
+
 
 
 =pod
@@ -349,7 +346,7 @@ CPAN::Meta - the distribution metadata for a CPAN dist
 
 =head1 VERSION
 
-version 2.110930
+version 2.112150
 
 =head1 SYNOPSIS
 
@@ -644,6 +641,10 @@ particular keys may be retrieved with the C<custom> method.
 
 If a custom key refers to a data structure, a deep clone is returned.
 
+=for Pod::Coverage TO_JSON abstract author authors custom custom_keys description dynamic_config
+generated_by keywords license licenses meta_spec name no_index
+optional_features prereqs provides release_status resources version
+
 =head1 BUGS
 
 Please report any bugs or feature using the CPAN Request Tracker.
@@ -667,6 +668,25 @@ L<CPAN::Meta::Validator>
 
 =back
 
+=for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders
+
+=head1 SUPPORT
+
+=head2 Bugs / Feature Requests
+
+Please report any bugs or feature requests by email to C<bug-cpan-meta at rt.cpan.org>, or through
+the web interface at L<http://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Meta>. You will be automatically notified of any
+progress on the request by the system.
+
+=head2 Source Code
+
+This is open source software.  The code repository is available for
+public review and contribution under the terms of the license.
+
+L<http://github.com/dagolden/cpan-meta>
+
+  git clone git://github.com/dagolden/cpan-meta.git
+
 =head1 AUTHORS
 
 =over 4
index 2ea3456..9fedacb 100644 (file)
@@ -2,39 +2,29 @@ use 5.006;
 use strict;
 use warnings;
 package CPAN::Meta::Converter;
-BEGIN {
-  $CPAN::Meta::Converter::VERSION = eval '2.110930_001';
-}
-# ABSTRACT: Convert CPAN distribution metadata structures
+our $VERSION = '2.112150'; # VERSION
 
 
 use CPAN::Meta::Validator;
 use version 0.82 ();
 use Parse::CPAN::Meta 1.4400 ();
-use Carp qw(croak);
 
 sub _dclone {
   my $ref = shift;
 
-  # Work around JSON::PP's lack of a convert_blessed_universally
-  local *UNIVERSAL::TO_JSON = sub {
-      my $obj = shift;
-
-      # Special case: stringify version objects
-      # Everything else: serialize
-      return $obj->isa("version") ? "$obj"    :
-             $obj->isa("HASH")    ? { %$obj } :
-             $obj->isa("ARRAY")   ? { @$obj } :
-                                    croak "Don't know how to serialize $obj";
-  };
+  # if an object is in the data structure and doesn't specify how to
+  # turn itself into JSON, we just stringify the object.  That does the
+  # right thing for typical things that might be there, like version objects,
+  # Path::Class objects, etc.
+  no warnings 'once';
+  local *UNIVERSAL::TO_JSON = sub { return "$_[0]" };
 
   my $backend = Parse::CPAN::Meta->json_backend();
   return $backend->new->decode(
-    $backend->new->convert_blessed->allow_blessed->encode($ref)
+    $backend->new->allow_blessed->convert_blessed->encode($ref)
   );
 }
 
-
 my %known_specs = (
     '2'   => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec',
     '1.4' => 'http://module-build.sourceforge.net/META-spec-v1.4.html',
@@ -1258,6 +1248,8 @@ sub convert {
 
 1;
 
+# ABSTRACT: Convert CPAN distribution metadata structures
+
 
 
 =pod
@@ -1268,7 +1260,7 @@ CPAN::Meta::Converter - Convert CPAN distribution metadata structures
 
 =head1 VERSION
 
-version 2.110930
+version 2.112150
 
 =head1 SYNOPSIS
 
index d8258dc..fdec692 100644 (file)
@@ -2,10 +2,7 @@ use 5.006;
 use strict;
 use warnings;
 package CPAN::Meta::Feature;
-BEGIN {
-  $CPAN::Meta::Feature::VERSION = '2.110930';
-}
-# ABSTRACT: an optional feature provided by a CPAN distribution
+our $VERSION = '2.112150'; # VERSION
 
 use CPAN::Meta::Prereqs;
 
@@ -33,6 +30,8 @@ sub prereqs     { $_[0]{prereqs} }
 
 1;
 
+# ABSTRACT: an optional feature provided by a CPAN distribution
+
 
 
 =pod
@@ -43,7 +42,7 @@ CPAN::Meta::Feature - an optional feature provided by a CPAN distribution
 
 =head1 VERSION
 
-version 2.110930
+version 2.112150
 
 =head1 DESCRIPTION
 
index 9ccbfd4..49a614b 100644 (file)
@@ -3,12 +3,12 @@ use 5.006;
 use strict;
 use warnings;
 package CPAN::Meta::History;
-BEGIN {
-  $CPAN::Meta::History::VERSION = '2.110930';
-}
-# ABSTRACT: history of CPAN Meta Spec changes
+our $VERSION = '2.112150'; # VERSION
+
 1;
 
+# ABSTRACT: history of CPAN Meta Spec changes
+
 
 
 __END__
@@ -20,7 +20,7 @@ CPAN::Meta::History - history of CPAN Meta Spec changes
 
 =head1 VERSION
 
-version 2.110930
+version 2.112150
 
 =head1 DESCRIPTION
 
index 29a2e5a..5d1d1f0 100644 (file)
@@ -2,10 +2,7 @@ use 5.006;
 use strict;
 use warnings;
 package CPAN::Meta::Prereqs;
-BEGIN {
-  $CPAN::Meta::Prereqs::VERSION = '2.110930';
-}
-# ABSTRACT: a set of distribution prerequisites by phase and type
+our $VERSION = '2.112150'; # VERSION
 
 
 use Carp qw(confess);
@@ -140,6 +137,8 @@ sub clone {
 
 1;
 
+# ABSTRACT: a set of distribution prerequisites by phase and type
+
 
 
 =pod
@@ -150,7 +149,7 @@ CPAN::Meta::Prereqs - a set of distribution prerequisites by phase and type
 
 =head1 VERSION
 
-version 2.110930
+version 2.112150
 
 =head1 DESCRIPTION
 
index b32fdac..c5f8213 100644 (file)
@@ -3,12 +3,12 @@ use 5.006;
 use strict;
 use warnings;
 package CPAN::Meta::Spec;
-BEGIN {
-  $CPAN::Meta::Spec::VERSION = '2.110930';
-}
-# ABSTRACT: specification for CPAN distribution metadata
+our $VERSION = '2.112150'; # VERSION
+
 1;
 
+# ABSTRACT: specification for CPAN distribution metadata
+
 
 
 __END__
@@ -20,7 +20,7 @@ CPAN::Meta::Spec - specification for CPAN distribution metadata
 
 =head1 VERSION
 
-version 2.110930
+version 2.112150
 
 =head1 SYNOPSIS
 
@@ -664,8 +664,9 @@ the distribution.  The values are Maps with the following valid subkeys:
 
 =item file
 
-This field is required.  The value must contain a relative file path
-from the root of the distribution to the module containing the package.
+This field is required.  The value must contain a Unix-style relative
+file path from the root of the distribution to the module containing the
+package.
 
 =item version
 
@@ -681,12 +682,12 @@ Example:
     license     => [ 'http://dev.perl.org/licenses/' ],
     homepage    => 'http://sourceforge.net/projects/module-build',
     bugtracker  => {
-      web    => 'http://github.com/dagolden/cpan-meta-spec/issues',
+      web    => 'http://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Meta',
       mailto => 'meta-bugs@example.com',
     },
     repository  => {
-      url  => 'git://github.com/dagolden/cpan-meta-spec.git',
-      web  => 'http://github.com/dagolden/cpan-meta-spec',
+      url  => 'git://github.com/dagolden/cpan-meta.git',
+      web  => 'http://github.com/dagolden/cpan-meta',
       type => 'git',
     },
     x_twitter   => 'http://twitter.com/cpan_linked/',
@@ -1028,10 +1029,10 @@ if both are found.
 =head2 Extracting Version Numbers from Perl Modules
 
 To get the version number from a Perl module, consumers should use the
-C<< MM->parse_version($file) >> method provided by L<ExtUtils::MakeMaker> or
-the L<Module::Build::ModuleInfo> module provided with L<Module::Build>.  For
-example, for the module given by C<$mod>, the version may be retrieved in one
-of the following ways:
+C<< MM->parse_version($file) >> method provided by
+L<ExtUtils::MakeMaker> or L<Module::Metadata>.  For example, for the
+module given by C<$mod>, the version may be retrieved in one of the
+following ways:
 
   # via ExtUtils::MakeMaker
   my $file = MM->_installed_file_for_module($mod);
@@ -1040,14 +1041,14 @@ of the following ways:
 The private C<_installed_file_for_module> method may be replaced with
 other methods for locating a module in C<@INC>.
 
-  # via Module::Build
-  my $info = Module::Build::ModuleInfo->new_from_module($mod);
+  # via Module::Metadata
+  my $info = Module::Metadata->new_from_module($mod);
   my $version = $info->version;
 
 If only a filename is available, the following approach may be used:
 
   # via Module::Build
-  my $info = Module::Build::ModuleInfo->new_from_file($file);
+  my $info = Module::Metadata->new_from_file($file);
   my $version = $info->version;
 
 =head2 Comparing Version Numbers
index 819011c..b9f9868 100644 (file)
@@ -2,10 +2,7 @@ use 5.006;
 use strict;
 use warnings;
 package CPAN::Meta::Validator;
-BEGIN {
-  $CPAN::Meta::Validator::VERSION = '2.110930';
-}
-# ABSTRACT: validate CPAN distribution metadata structures
+our $VERSION = '2.112150'; # VERSION
 
 
 #--------------------------------------------------------------------------#
@@ -692,7 +689,7 @@ my %v1_licenses = (
     'apache'       => 'http://apache.org/licenses/LICENSE-2.0',
     'artistic'     => 'http://opensource.org/licenses/artistic-license.php',
     'artistic_2'   => 'http://opensource.org/licenses/artistic-license-2.0.php',
-    'lgpl'         => 'http://www.opensource.org/licenses/lgpl-license.phpt',
+    'lgpl'         => 'http://www.opensource.org/licenses/lgpl-license.php',
     'bsd'          => 'http://www.opensource.org/licenses/bsd-license.php',
     'gpl'          => 'http://www.opensource.org/licenses/gpl-license.php',
     'mit'          => 'http://opensource.org/licenses/mit-license.php',
@@ -829,6 +826,8 @@ sub _error {
 
 1;
 
+# ABSTRACT: validate CPAN distribution metadata structures
+
 
 
 =pod
@@ -839,7 +838,7 @@ CPAN::Meta::Validator - validate CPAN distribution metadata structures
 
 =head1 VERSION
 
-version 2.110930
+version 2.112150
 
 =head1 SYNOPSIS
 
@@ -881,87 +880,143 @@ is valid.
 
 Returns a list of errors seen during validation.
 
-=begin internals
+=begin :internals
 
 =head2 Check Methods
 
 =over
 
-=item * check_map($spec,$data)
+=item *
+
+check_map($spec,$data)
 
 Checks whether a map (or hash) part of the data structure conforms to the
 appropriate specification definition.
-=item * check_list($spec,$data)
+
+=item *
+
+check_list($spec,$data)
 
 Checks whether a list (or array) part of the data structure conforms to
 the appropriate specification definition.
-=item * check_lazylist($spec,$data)
+
+=item *
+
+check_lazylist($spec,$data)
 
 Checks whether a list conforms, but converts strings to a single-element list
+
 =back
 
 =head2 Validator Methods
 
 =over
 
-=item * header($self,$key,$value)
+=item *
+
+header($self,$key,$value)
 
 Validates that the header is valid.
 
-Note: No longer used as we now read the data structure, not the file.=item * url($self,$key,$value)
+Note: No longer used as we now read the data structure, not the file.
+
+=item *
+
+url($self,$key,$value)
 
 Validates that a given value is in an acceptable URL format
-=item * urlspec($self,$key,$value)
+
+=item *
+
+urlspec($self,$key,$value)
 
 Validates that the URL to a META specification is a known one.
-=item * string_or_undef($self,$key,$value)
+
+=item *
+
+string_or_undef($self,$key,$value)
 
 Validates that the value is either a string or an undef value. Bit of a
 catchall function for parts of the data structure that are completely user
 defined.
-=item * string($self,$key,$value)
+
+=item *
+
+string($self,$key,$value)
 
 Validates that a string exists for the given key.
-=item * file($self,$key,$value)
+
+=item *
+
+file($self,$key,$value)
 
 Validate that a file is passed for the given key. This may be made more
 thorough in the future. For now it acts like \&string.
-=item * exversion($self,$key,$value)
+
+=item *
+
+exversion($self,$key,$value)
 
 Validates a list of versions, e.g. '<= 5, >=2, ==3, !=4, >1, <6, 0'.
-=item * version($self,$key,$value)
+
+=item *
+
+version($self,$key,$value)
 
 Validates a single version string. Versions of the type '5.8.8' and '0.00_00'
 are both valid. A leading 'v' like 'v1.2.3' is also valid.
-=item * boolean($self,$key,$value)
+
+=item *
+
+boolean($self,$key,$value)
 
 Validates for a boolean value. Currently these values are '1', '0', 'true',
 'false', however the latter 2 may be removed.
-=item * license($self,$key,$value)
+
+=item *
+
+license($self,$key,$value)
 
 Validates that a value is given for the license. Returns 1 if an known license
 type, or 2 if a value is given but the license type is not a recommended one.
-=item * custom_1($self,$key,$value)
+
+=item *
+
+custom_1($self,$key,$value)
 
 Validates that the given key is in CamelCase, to indicate a user defined
 keyword and only has characters in the class [-_a-zA-Z].  In version 1.X
 of the spec, this was only explicitly stated for 'resources'.
-=item * custom_2($self,$key,$value)
+
+=item *
+
+custom_2($self,$key,$value)
 
 Validates that the given key begins with 'x_' or 'X_', to indicate a user
 defined keyword and only has characters in the class [-_a-zA-Z]
-=item * identifier($self,$key,$value)
+
+=item *
+
+identifier($self,$key,$value)
 
 Validates that key is in an acceptable format for the META specification,
 for an identifier, i.e. any that matches the regular expression
 qr/[a-z][a-z_]/i.
-=item * module($self,$key,$value)
+
+=item *
+
+module($self,$key,$value)
 
 Validates that a given key is in an acceptable module name format, e.g.
 'Test::CPAN::Meta::Version'.
+
 =back
 
-=end internals
+=end :internals
+
+=for Pod::Coverage anything boolean check_lazylist check_list custom_1 custom_2 exversion file
+identifier license module phase relation release_status string string_or_undef
+url urlspec version header check_map
 
 =head1 BUGS
 
index 5cd3e44..4bab817 100644 (file)
@@ -8,6 +8,20 @@ use CPAN::Meta::Converter;
 use File::Spec;
 use IO::Dir;
 use Parse::CPAN::Meta 1.4400;
+use version;
+
+# mock file object
+package
+  File::StringObject;
+
+use overload q{""} => sub { ${$_[0]} }, fallback => 1;
+
+sub new {
+  my ($class, $file) = @_;
+  bless \$file, $class;
+}
+
+package main;
 
 my $data_dir = IO::Dir->new( 't/data' );
 my @files = sort grep { /^\w/ } $data_dir->read;
@@ -148,5 +162,16 @@ for my $f ( reverse sort @files ) {
   );
 }
 
-done_testing;
+# specific test for object conversion
+{
+  my $path = File::Spec->catfile('t','data','resources.yml');
+  my $original = Parse::CPAN::Meta->load_file( $path  );
+  ok( $original, "loaded resources.yml" );
+  $original->{version} = version->new("1.64");
+  $original->{no_index}{file} = File::StringObject->new(".gitignore");
+  pass( "replaced some data fields with objects" );
+  my $cmc = CPAN::Meta::Converter->new( $original );
+  ok( my $converted = $cmc->convert( version => 2 ), "conversion successful" );
+}
 
+done_testing;
index 88119dc..6ab99d0 100644 (file)
@@ -111,6 +111,15 @@ Fixed support for v-strings and x.y.z versions with v5.8.4
 
 =item *
 
+L<CPAN::Meta> has been upgraded from version 2.110930_001 to version 2.112150
+
+Stringify any objects encountered during conversion.
+
+Clarified that file paths in the 'provides' section must be in
+Unix-style (i.e. forward slashes)
+
+=item *
+
 L<ExtUtils::Install> has been upgraded from version 1.56 to version 1.57.
 
 There is no change to ExtUtils::Install other than the version number