r67951 - in /trunk/libcpan-meta-perl: ./ debian/ lib/CPAN/ lib/CPAN/Meta/ t/

periapt-guest at users.alioth.debian.org periapt-guest at users.alioth.debian.org
Thu Jan 27 20:30:43 UTC 2011


Author: periapt-guest
Date: Thu Jan 27 20:30:33 2011
New Revision: 67951

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=67951
Log:
New upstream release

Modified:
    trunk/libcpan-meta-perl/Changes
    trunk/libcpan-meta-perl/META.json
    trunk/libcpan-meta-perl/META.yml
    trunk/libcpan-meta-perl/Makefile.PL
    trunk/libcpan-meta-perl/README
    trunk/libcpan-meta-perl/debian/changelog
    trunk/libcpan-meta-perl/dist.ini
    trunk/libcpan-meta-perl/lib/CPAN/Meta.pm
    trunk/libcpan-meta-perl/lib/CPAN/Meta/Converter.pm
    trunk/libcpan-meta-perl/lib/CPAN/Meta/Feature.pm
    trunk/libcpan-meta-perl/lib/CPAN/Meta/History.pm
    trunk/libcpan-meta-perl/lib/CPAN/Meta/Prereqs.pm
    trunk/libcpan-meta-perl/lib/CPAN/Meta/Spec.pm
    trunk/libcpan-meta-perl/lib/CPAN/Meta/Validator.pm
    trunk/libcpan-meta-perl/t/converter-bad.t
    trunk/libcpan-meta-perl/t/converter-fail.t
    trunk/libcpan-meta-perl/t/converter.t
    trunk/libcpan-meta-perl/t/save-load.t
    trunk/libcpan-meta-perl/t/validator.t

Modified: trunk/libcpan-meta-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/Changes?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/Changes (original)
+++ trunk/libcpan-meta-perl/Changes Thu Jan 27 20:30:33 2011
@@ -1,4 +1,14 @@
 Revision history for CPAN-Meta
+
+2.110240  2011-01-24 16:28:25 EST5EDT
+
+  - Reading JSON/YAML is delegated entirely to Parse::CPAN::Meta (1.4200)
+  
+  - JSON.pm is dropped as a prerequisite and JSON::PP is added to prepare
+    for CPAN::Meta to be added to the Perl core
+
+  - JSON writing uses the same JSON backend selection as Parse::CPAN::Meta
+    to allow "upgrading" to a non-core JSON backend module if desired
 
 2.102400  2010-08-28 14:06:34 America/New_York
 

Modified: trunk/libcpan-meta-perl/META.json
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/META.json?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/META.json (original)
+++ trunk/libcpan-meta-perl/META.json Thu Jan 27 20:30:33 2011
@@ -5,7 +5,7 @@
       "Ricardo Signes <rjbs at cpan.org>"
    ],
    "dynamic_config" : 0,
-   "generated_by" : "Dist::Zilla version 4.102340, CPAN::Meta::Converter version 2.102160",
+   "generated_by" : "Dist::Zilla version 4.200001, CPAN::Meta::Converter version 2.102400",
    "license" : [
       "perl_5"
    ],
@@ -28,8 +28,9 @@
       "runtime" : {
          "requires" : {
             "Carp" : 0,
-            "JSON" : "2",
-            "Parse::CPAN::Meta" : 0,
+            "JSON::PP" : "2.27103",
+            "Module::Load::Conditional" : 0,
+            "Parse::CPAN::Meta" : "1.4200",
             "Scalar::Util" : 0,
             "Storable" : 0,
             "Version::Requirements" : "0.101020",
@@ -44,7 +45,8 @@
             "File::Spec" : 0,
             "File::Temp" : "0.20",
             "IO::Dir" : 0,
-            "Test::More" : "0.88"
+            "Parse::CPAN::Meta" : "1.4200",
+            "Test::More" : "0.96"
          }
       }
    },
@@ -56,7 +58,7 @@
          "web" : "http://github.com/dagolden/cpan-meta"
       }
    },
-   "version" : "2.102400",
+   "version" : "2.110240",
    "x_Dist_Zilla" : {
       "plugins" : [
          {
@@ -77,162 +79,184 @@
          {
             "class" : "Dist::Zilla::Plugin::GatherDir",
             "name" : "@Filter/@Basic/GatherDir",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::PruneCruft",
             "name" : "@Filter/@Basic/PruneCruft",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::ManifestSkip",
             "name" : "@Filter/@Basic/ManifestSkip",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaYAML",
             "name" : "@Filter/@Basic/MetaYAML",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::License",
             "name" : "@Filter/@Basic/License",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::Readme",
             "name" : "@Filter/@Basic/Readme",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::ExecDir",
             "name" : "@Filter/@Basic/ExecDir",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::ShareDir",
             "name" : "@Filter/@Basic/ShareDir",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::MakeMaker",
             "name" : "@Filter/@Basic/MakeMaker",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::Manifest",
             "name" : "@Filter/@Basic/Manifest",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::TestRelease",
             "name" : "@Filter/@Basic/TestRelease",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::ConfirmRelease",
             "name" : "@Filter/@Basic/ConfirmRelease",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::UploadToCPAN",
             "name" : "@Filter/@Basic/UploadToCPAN",
-            "version" : "4.102340"
-         },
-         {
-            "class" : "Dist::Zilla::Plugin::AutoPrereq",
-            "name" : "@Filter/AutoPrereq",
-            "version" : "4.102340"
+            "version" : "4.200001"
+         },
+         {
+            "class" : "Dist::Zilla::Plugin::AutoPrereqs",
+            "name" : "@Filter/AutoPrereqs",
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::PkgVersion",
             "name" : "@Filter/PkgVersion",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaConfig",
             "name" : "@Filter/MetaConfig",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaJSON",
             "name" : "@Filter/MetaJSON",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::NextRelease",
             "name" : "@Filter/NextRelease",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::PodSyntaxTests",
             "name" : "@Filter/PodSyntaxTests",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::Repository",
             "name" : "@Filter/Repository",
-            "version" : "0.13"
+            "version" : "0.17"
+         },
+         {
+            "class" : "Dist::Zilla::Plugin::Prereqs",
+            "config" : {
+               "Dist::Zilla::Plugin::Prereqs" : {
+                  "phase" : "test",
+                  "type" : "requires"
+               }
+            },
+            "name" : "@Filter/TestMoreWithSubtests",
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::PodWeaver",
             "name" : "@Filter/PodWeaver",
-            "version" : "3.101640"
+            "version" : "3.101641"
          },
          {
             "class" : "Dist::Zilla::Plugin::Git::Check",
             "name" : "@Filter/@Git/Check",
-            "version" : "1.102090"
+            "version" : "1.103520"
          },
          {
             "class" : "Dist::Zilla::Plugin::Git::Commit",
             "name" : "@Filter/@Git/Commit",
-            "version" : "1.102090"
+            "version" : "1.103520"
          },
          {
             "class" : "Dist::Zilla::Plugin::Git::Tag",
             "name" : "@Filter/@Git/Tag",
-            "version" : "1.102090"
+            "version" : "1.103520"
          },
          {
             "class" : "Dist::Zilla::Plugin::Git::Push",
             "name" : "@Filter/@Git/Push",
-            "version" : "1.102090"
+            "version" : "1.103520"
+         },
+         {
+            "class" : "Dist::Zilla::Plugin::Prereqs",
+            "config" : {
+               "Dist::Zilla::Plugin::Prereqs" : {
+                  "phase" : "runtime",
+                  "type" : "requires"
+               }
+            },
+            "name" : "Prereqs",
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::AutoVersion",
             "name" : "AutoVersion",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::Git::Push",
             "name" : "Git::Push",
-            "version" : "1.102090"
+            "version" : "1.103520"
          },
          {
             "class" : "Dist::Zilla::Plugin::MetaResources",
             "name" : "MetaResources",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":InstallModules",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":TestFiles",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":ExecFiles",
-            "version" : "4.102340"
+            "version" : "4.200001"
          },
          {
             "class" : "Dist::Zilla::Plugin::FinderCode",
             "name" : ":ShareFiles",
-            "version" : "4.102340"
+            "version" : "4.200001"
          }
       ],
       "zilla" : {
@@ -240,7 +264,7 @@
          "config" : {
             "is_trial" : 0
          },
-         "version" : "4.102340"
+         "version" : "4.200001"
       }
    }
 }

Modified: trunk/libcpan-meta-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/META.yml?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/META.yml (original)
+++ trunk/libcpan-meta-perl/META.yml Thu Jan 27 20:30:33 2011
@@ -8,11 +8,12 @@
   File::Spec: 0
   File::Temp: 0.20
   IO::Dir: 0
-  Test::More: 0.88
+  Parse::CPAN::Meta: 1.4200
+  Test::More: 0.96
 configure_requires:
   ExtUtils::MakeMaker: 6.31
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.102340, CPAN::Meta::Converter version 2.102160'
+generated_by: 'Dist::Zilla version 4.200001, CPAN::Meta::Converter version 2.102400'
 license: perl
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -23,8 +24,9 @@
     - history
 requires:
   Carp: 0
-  JSON: 2
-  Parse::CPAN::Meta: 0
+  JSON::PP: 2.27103
+  Module::Load::Conditional: 0
+  Parse::CPAN::Meta: 1.4200
   Scalar::Util: 0
   Storable: 0
   Version::Requirements: 0.101020
@@ -33,7 +35,7 @@
   version: 0.82
 resources:
   repository: http://github.com/dagolden/cpan-meta.git
-version: 2.102400
+version: 2.110240
 x_Dist_Zilla:
   plugins:
     -
@@ -51,133 +53,149 @@
     -
       class: Dist::Zilla::Plugin::GatherDir
       name: '@Filter/@Basic/GatherDir'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::PruneCruft
       name: '@Filter/@Basic/PruneCruft'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::ManifestSkip
       name: '@Filter/@Basic/ManifestSkip'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::MetaYAML
       name: '@Filter/@Basic/MetaYAML'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::License
       name: '@Filter/@Basic/License'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::Readme
       name: '@Filter/@Basic/Readme'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::ExecDir
       name: '@Filter/@Basic/ExecDir'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::ShareDir
       name: '@Filter/@Basic/ShareDir'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::MakeMaker
       name: '@Filter/@Basic/MakeMaker'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::Manifest
       name: '@Filter/@Basic/Manifest'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::TestRelease
       name: '@Filter/@Basic/TestRelease'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::ConfirmRelease
       name: '@Filter/@Basic/ConfirmRelease'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::UploadToCPAN
       name: '@Filter/@Basic/UploadToCPAN'
-      version: 4.102340
-    -
-      class: Dist::Zilla::Plugin::AutoPrereq
-      name: '@Filter/AutoPrereq'
-      version: 4.102340
+      version: 4.200001
+    -
+      class: Dist::Zilla::Plugin::AutoPrereqs
+      name: '@Filter/AutoPrereqs'
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::PkgVersion
       name: '@Filter/PkgVersion'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::MetaConfig
       name: '@Filter/MetaConfig'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::MetaJSON
       name: '@Filter/MetaJSON'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::NextRelease
       name: '@Filter/NextRelease'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::PodSyntaxTests
       name: '@Filter/PodSyntaxTests'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::Repository
       name: '@Filter/Repository'
-      version: 0.13
+      version: 0.17
+    -
+      class: Dist::Zilla::Plugin::Prereqs
+      config:
+        Dist::Zilla::Plugin::Prereqs:
+          phase: test
+          type: requires
+      name: '@Filter/TestMoreWithSubtests'
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::PodWeaver
       name: '@Filter/PodWeaver'
-      version: 3.101640
+      version: 3.101641
     -
       class: Dist::Zilla::Plugin::Git::Check
       name: '@Filter/@Git/Check'
-      version: 1.102090
+      version: 1.103520
     -
       class: Dist::Zilla::Plugin::Git::Commit
       name: '@Filter/@Git/Commit'
-      version: 1.102090
+      version: 1.103520
     -
       class: Dist::Zilla::Plugin::Git::Tag
       name: '@Filter/@Git/Tag'
-      version: 1.102090
+      version: 1.103520
     -
       class: Dist::Zilla::Plugin::Git::Push
       name: '@Filter/@Git/Push'
-      version: 1.102090
+      version: 1.103520
+    -
+      class: Dist::Zilla::Plugin::Prereqs
+      config:
+        Dist::Zilla::Plugin::Prereqs:
+          phase: runtime
+          type: requires
+      name: Prereqs
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::AutoVersion
       name: AutoVersion
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::Git::Push
       name: Git::Push
-      version: 1.102090
+      version: 1.103520
     -
       class: Dist::Zilla::Plugin::MetaResources
       name: MetaResources
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':InstallModules'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':TestFiles'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':ExecFiles'
-      version: 4.102340
+      version: 4.200001
     -
       class: Dist::Zilla::Plugin::FinderCode
       name: ':ShareFiles'
-      version: 4.102340
+      version: 4.200001
   zilla:
     class: Dist::Zilla::Dist::Builder
     config:
       is_trial: 0
-    version: 4.102340
+    version: 4.200001

Modified: trunk/libcpan-meta-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/Makefile.PL?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/Makefile.PL (original)
+++ trunk/libcpan-meta-perl/Makefile.PL Thu Jan 27 20:30:33 2011
@@ -16,7 +16,8 @@
     'File::Spec' => '0',
     'File::Temp' => '0.20',
     'IO::Dir' => '0',
-    'Test::More' => '0.88'
+    'Parse::CPAN::Meta' => '1.4200',
+    'Test::More' => '0.96'
   },
   'CONFIGURE_REQUIRES' => {
     'ExtUtils::MakeMaker' => '6.31'
@@ -27,15 +28,16 @@
   'NAME' => 'CPAN::Meta',
   'PREREQ_PM' => {
     'Carp' => '0',
-    'JSON' => '2',
-    'Parse::CPAN::Meta' => '0',
+    'JSON::PP' => '2.27103',
+    'Module::Load::Conditional' => '0',
+    'Parse::CPAN::Meta' => '1.4200',
     'Scalar::Util' => '0',
     'Storable' => '0',
     'Version::Requirements' => '0.101020',
     'autodie' => '0',
     'version' => '0.82'
   },
-  'VERSION' => '2.102400',
+  'VERSION' => '2.110240',
   'test' => {
     'TESTS' => 't/*.t'
   }

Modified: trunk/libcpan-meta-perl/README
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/README?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/README (original)
+++ trunk/libcpan-meta-perl/README Thu Jan 27 20:30:33 2011
@@ -1,7 +1,7 @@
 
 
 This archive contains the distribution CPAN-Meta,
-version 2.102400:
+version 2.110240:
 
   the distribution metadata for a CPAN dist
 

Modified: trunk/libcpan-meta-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/debian/changelog?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/debian/changelog (original)
+++ trunk/libcpan-meta-perl/debian/changelog Thu Jan 27 20:30:33 2011
@@ -1,8 +1,12 @@
-libcpan-meta-perl (2.102400-2) UNRELEASED; urgency=low
+libcpan-meta-perl (2.110240-1) UNRELEASED; urgency=low
 
+  [ Ansgar Burchardt ]
   * Update my email address.
 
- -- Ansgar Burchardt <ansgar at debian.org>  Mon, 01 Nov 2010 11:16:29 +0100
+  [ Nicholas Bamber ]
+  * New upstream release
+
+ -- Nicholas Bamber <nicholas at periapt.co.uk>  Thu, 27 Jan 2011 20:27:47 +0000
 
 libcpan-meta-perl (2.102400-1) unstable; urgency=low
 

Modified: trunk/libcpan-meta-perl/dist.ini
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/dist.ini?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/dist.ini (original)
+++ trunk/libcpan-meta-perl/dist.ini Thu Jan 27 20:30:33 2011
@@ -12,9 +12,14 @@
 [CheckChangesHasContent]
 
 [@Filter]
-bundle = @RJBS
-remove = ExtraTests
-remove = AutoVersion
+-bundle = @RJBS
+-remove = ExtraTests
+-remove = AutoVersion
+-remove = Git::NextVersion
+
+[Prereqs]
+Parse::CPAN::Meta = 1.4200
+JSON::PP = 2.27103
 
 [AutoVersion]
 major = 2

Modified: trunk/libcpan-meta-perl/lib/CPAN/Meta.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/lib/CPAN/Meta.pm?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/lib/CPAN/Meta.pm (original)
+++ trunk/libcpan-meta-perl/lib/CPAN/Meta.pm Thu Jan 27 20:30:33 2011
@@ -4,7 +4,7 @@
 use autodie;
 package CPAN::Meta;
 BEGIN {
-  $CPAN::Meta::VERSION = '2.102400';
+  $CPAN::Meta::VERSION = '2.110240';
 }
 # ABSTRACT: the distribution metadata for a CPAN dist
 
@@ -14,8 +14,7 @@
 use CPAN::Meta::Prereqs;
 use CPAN::Meta::Converter;
 use CPAN::Meta::Validator;
-use JSON 2 ();
-use Parse::CPAN::Meta ();
+use Module::Load::Conditional qw(can_load);
 use Storable ();
 
 
@@ -146,38 +145,20 @@
 }
 
 
-# XXX private to help tests conversion/validation -- dagolden, 2010-04-12
-sub _load_file {
-  my ($class, $file) = @_;
-
-  my $struct;
-  if ( $file =~ m{\.json} ) {
-    my $guts = do { local (@ARGV,$/) = $file; <> };
-    $struct = JSON->new->utf8->decode($guts);
-  }
-  elsif ( $file =~ m{\.ya?ml} ) {
-    my $guts = do { local (@ARGV,$/) = $file; <> };
-    $guts =~ s{\n?\z}{\n}ms;
-    my @yaml = Parse::CPAN::Meta::Load( $guts );
-    $struct = $yaml[0];
-  }
-  else {
-    die "Could not determine the filetype of '$file'\n";
-  }
-  return $struct;
-}
-
-# XXX: Much of this can be simplified when we can rely on a JSON-speaking
-# upstream Parse::CPAN::Meta. -- rjbs, 2010-04-12
 sub load_file {
   my ($class, $file, $options) = @_;
   $options->{lazy_validation} = 1 unless exists $options->{lazy_validation};
 
+  local $Module::Load::Conditional::CHECK_INC_HASH = 1;
+  can_load( modules => { 'Parse::CPAN::Meta' => 1.4200 } )
+    or croak "CPAN::Meta requires Parse::CPAN::Meta 1.4200 or later\n";
+
   croak "load_file() requires a valid, readable filename"
     unless -r $file;
+
   my $self;
   eval {
-    my $struct = $class->_load_file( $file );
+    my $struct = Parse::CPAN::Meta->load_file( $file );
     $self = $class->_new($struct, $options);
   };
   croak($@) if $@;
@@ -191,7 +172,7 @@
 
   my $self;
   eval {
-    my ($struct) = Parse::CPAN::Meta::Load( $yaml );
+    my ($struct) = Parse::CPAN::Meta->load_yaml_string( $yaml );
     $self = $class->_new($struct, $options);
   };
   croak($@) if $@;
@@ -205,7 +186,7 @@
 
   my $self;
   eval {
-    my $struct = JSON->new->utf8->decode($json);
+    my $struct = Parse::CPAN::Meta->load_json_string( $json );
     $self = $class->_new($struct, $options);
   };
   croak($@) if $@;
@@ -220,7 +201,23 @@
     unless $file =~ m{\.json$};
 
   open my $fh, ">", $file;
-  print {$fh} JSON->new->utf8->pretty->encode({%$self});
+  print {$fh} _choose_json_backend()->new->utf8->pretty->encode({%$self});
+}
+
+# Copied from Parse::CPAN::Meta
+sub _choose_json_backend {
+  local $Module::Load::Conditional::CHECK_INC_HASH = 1;
+  if (! $ENV{PERL_JSON_BACKEND} or $ENV{PERL_JSON_BACKEND} eq 'JSON::PP') {
+    can_load( modules => {'JSON::PP' => 2.27103}, verbose => 0 )
+      or croak "JSON::PP 2.27103 is not available\n";
+    return 'JSON::PP';
+  }
+  else {
+    can_load( modules => {'JSON' => 2.5}, verbose => 0 )
+      or croak  "JSON 2.5 is required for " .
+                "\$ENV{PERL_JSON_BACKEND} = '$ENV{PERL_JSON_BACKEND}'\n";
+    return "JSON";
+  }
 }
 
 
@@ -299,9 +296,11 @@
 
 sub as_struct {
   my ($self) = @_;
-  return JSON->new->decode( JSON->new->convert_blessed->encode( $self ) )
-}
-
+  my $json = _choose_json_backend();
+  return $json->new->decode( $json->new->convert_blessed->encode( $self ) )
+}
+
+# Used by JSON::PP, etc. for "convert_blessed"
 sub TO_JSON {
   return { %{ $_[0] } };
 }
@@ -318,7 +317,7 @@
 
 =head1 VERSION
 
-version 2.102400
+version 2.110240
 
 =head1 SYNOPSIS
 
@@ -415,7 +414,9 @@
   $meta->save($distmeta_file);
 
 Serializes the object as JSON and writes it to the given file.  The filename
-should end in '.json'.
+should end in '.json'.  L<JSON::PP> is the default JSON backend. Using another
+JSON backend requires L<JSON> 2.5 or later and you must set the
+C<$ENV{PERL_JSON_BACKEND}> to a supported alternate backend like L<JSON::XS>.
 
 =head2 meta_spec_version
 

Modified: trunk/libcpan-meta-perl/lib/CPAN/Meta/Converter.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/lib/CPAN/Meta/Converter.pm?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/lib/CPAN/Meta/Converter.pm (original)
+++ trunk/libcpan-meta-perl/lib/CPAN/Meta/Converter.pm Thu Jan 27 20:30:33 2011
@@ -4,7 +4,7 @@
 use autodie;
 package CPAN::Meta::Converter;
 BEGIN {
-  $CPAN::Meta::Converter::VERSION = '2.102400';
+  $CPAN::Meta::Converter::VERSION = '2.110240';
 }
 # ABSTRACT: Convert CPAN distribution metadata structures
 
@@ -1243,7 +1243,7 @@
 
 =head1 VERSION
 
-version 2.102400
+version 2.110240
 
 =head1 SYNOPSIS
 

Modified: trunk/libcpan-meta-perl/lib/CPAN/Meta/Feature.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/lib/CPAN/Meta/Feature.pm?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/lib/CPAN/Meta/Feature.pm (original)
+++ trunk/libcpan-meta-perl/lib/CPAN/Meta/Feature.pm Thu Jan 27 20:30:33 2011
@@ -4,7 +4,7 @@
 use autodie;
 package CPAN::Meta::Feature;
 BEGIN {
-  $CPAN::Meta::Feature::VERSION = '2.102400';
+  $CPAN::Meta::Feature::VERSION = '2.110240';
 }
 # ABSTRACT: an optional feature provided by a CPAN distribution
 
@@ -44,7 +44,7 @@
 
 =head1 VERSION
 
-version 2.102400
+version 2.110240
 
 =head1 DESCRIPTION
 

Modified: trunk/libcpan-meta-perl/lib/CPAN/Meta/History.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/lib/CPAN/Meta/History.pm?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/lib/CPAN/Meta/History.pm (original)
+++ trunk/libcpan-meta-perl/lib/CPAN/Meta/History.pm Thu Jan 27 20:30:33 2011
@@ -5,7 +5,7 @@
 use autodie;
 package CPAN::Meta::History;
 BEGIN {
-  $CPAN::Meta::History::VERSION = '2.102400';
+  $CPAN::Meta::History::VERSION = '2.110240';
 }
 # ABSTRACT: history of CPAN Meta Spec changes
 1;
@@ -21,7 +21,7 @@
 
 =head1 VERSION
 
-version 2.102400
+version 2.110240
 
 =head1 DESCRIPTION
 

Modified: trunk/libcpan-meta-perl/lib/CPAN/Meta/Prereqs.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/lib/CPAN/Meta/Prereqs.pm?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/lib/CPAN/Meta/Prereqs.pm (original)
+++ trunk/libcpan-meta-perl/lib/CPAN/Meta/Prereqs.pm Thu Jan 27 20:30:33 2011
@@ -4,7 +4,7 @@
 use autodie;
 package CPAN::Meta::Prereqs;
 BEGIN {
-  $CPAN::Meta::Prereqs::VERSION = '2.102400';
+  $CPAN::Meta::Prereqs::VERSION = '2.110240';
 }
 # ABSTRACT: a set of distribution prerequisites by phase and type
 
@@ -151,7 +151,7 @@
 
 =head1 VERSION
 
-version 2.102400
+version 2.110240
 
 =head1 DESCRIPTION
 

Modified: trunk/libcpan-meta-perl/lib/CPAN/Meta/Spec.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/lib/CPAN/Meta/Spec.pm?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/lib/CPAN/Meta/Spec.pm (original)
+++ trunk/libcpan-meta-perl/lib/CPAN/Meta/Spec.pm Thu Jan 27 20:30:33 2011
@@ -5,7 +5,7 @@
 use autodie;
 package CPAN::Meta::Spec;
 BEGIN {
-  $CPAN::Meta::Spec::VERSION = '2.102400';
+  $CPAN::Meta::Spec::VERSION = '2.110240';
 }
 # ABSTRACT: specification for CPAN distribution metadata
 1;
@@ -21,7 +21,7 @@
 
 =head1 VERSION
 
-version 2.102400
+version 2.110240
 
 =head1 SYNOPSIS
 

Modified: trunk/libcpan-meta-perl/lib/CPAN/Meta/Validator.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/lib/CPAN/Meta/Validator.pm?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/lib/CPAN/Meta/Validator.pm (original)
+++ trunk/libcpan-meta-perl/lib/CPAN/Meta/Validator.pm Thu Jan 27 20:30:33 2011
@@ -4,7 +4,7 @@
 use autodie;
 package CPAN::Meta::Validator;
 BEGIN {
-  $CPAN::Meta::Validator::VERSION = '2.102400';
+  $CPAN::Meta::Validator::VERSION = '2.110240';
 }
 # ABSTRACT: validate CPAN distribution metadata structures
 
@@ -840,7 +840,7 @@
 
 =head1 VERSION
 
-version 2.102400
+version 2.110240
 
 =head1 SYNOPSIS
 

Modified: trunk/libcpan-meta-perl/t/converter-bad.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/t/converter-bad.t?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/t/converter-bad.t (original)
+++ trunk/libcpan-meta-perl/t/converter-bad.t Thu Jan 27 20:30:33 2011
@@ -7,6 +7,7 @@
 use CPAN::Meta::Converter;
 use File::Spec;
 use IO::Dir;
+use Parse::CPAN::Meta 1.4200;
 
 my $data_dir = IO::Dir->new( 't/data-bad' );
 my @files = sort grep { /^\w/ } $data_dir->read;
@@ -17,7 +18,7 @@
 
 for my $f ( reverse sort @files ) {
   my $path = File::Spec->catfile('t','data-bad',$f);
-  my $original = CPAN::Meta->_load_file( $path  );
+  my $original = Parse::CPAN::Meta->load_file( $path  );
   ok( $original, "loaded $f" );
   my $original_v = _spec_version($original);
   # UPCONVERSION

Modified: trunk/libcpan-meta-perl/t/converter-fail.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/t/converter-fail.t?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/t/converter-fail.t (original)
+++ trunk/libcpan-meta-perl/t/converter-fail.t Thu Jan 27 20:30:33 2011
@@ -7,6 +7,7 @@
 use CPAN::Meta::Converter;
 use File::Spec;
 use IO::Dir;
+use Parse::CPAN::Meta 1.4200;
 
 my $data_dir = IO::Dir->new( 't/data-fail' );
 my @files = sort grep { /^\w/ } $data_dir->read;
@@ -17,7 +18,7 @@
 
 for my $f ( reverse sort @files ) {
   my $path = File::Spec->catfile('t','data-fail',$f);
-  my $original = CPAN::Meta->_load_file( $path  );
+  my $original = Parse::CPAN::Meta->load_file( $path  );
   ok( $original, "loaded invalid $f" );
   my $original_v = _spec_version($original);
   # UPCONVERSION

Modified: trunk/libcpan-meta-perl/t/converter.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/t/converter.t?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/t/converter.t (original)
+++ trunk/libcpan-meta-perl/t/converter.t Thu Jan 27 20:30:33 2011
@@ -7,6 +7,7 @@
 use CPAN::Meta::Converter;
 use File::Spec;
 use IO::Dir;
+use Parse::CPAN::Meta 1.4200;
 
 my $data_dir = IO::Dir->new( 't/data' );
 my @files = sort grep { /^\w/ } $data_dir->read;
@@ -17,7 +18,7 @@
 
 for my $f ( reverse sort @files ) {
   my $path = File::Spec->catfile('t','data',$f);
-  my $original = CPAN::Meta->_load_file( $path  );
+  my $original = Parse::CPAN::Meta->load_file( $path  );
   ok( $original, "loaded $f" );
   my $original_v = _spec_version($original);
   # UPCONVERSION
@@ -88,7 +89,7 @@
 # specific test for custom key handling
 {
   my $path = File::Spec->catfile('t','data','META-1_4.yml');
-  my $original = CPAN::Meta->_load_file( $path  );
+  my $original = Parse::CPAN::Meta->load_file( $path  );
   ok( $original, "loaded META-1_4.yml" );
   my $cmc = CPAN::Meta::Converter->new( $original );
   my $up_converted = $cmc->convert( version => 2 );
@@ -106,7 +107,7 @@
 # specific test for custom key handling
 {
   my $path = File::Spec->catfile('t','data','META-2.json');
-  my $original = CPAN::Meta->_load_file( $path  );
+  my $original = Parse::CPAN::Meta->load_file( $path  );
   ok( $original, "loaded META-2.json" );
   my $cmc = CPAN::Meta::Converter->new( $original );
   my $up_converted = $cmc->convert( version => 1.4 );
@@ -118,7 +119,7 @@
 # specific test for upconverting resources
 {
   my $path = File::Spec->catfile('t','data','resources.yml');
-  my $original = CPAN::Meta->_load_file( $path  );
+  my $original = Parse::CPAN::Meta->load_file( $path  );
   ok( $original, "loaded resources.yml" );
   my $cmc = CPAN::Meta::Converter->new( $original );
   my $converted = $cmc->convert( version => 2 );

Modified: trunk/libcpan-meta-perl/t/save-load.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/t/save-load.t?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/t/save-load.t (original)
+++ trunk/libcpan-meta-perl/t/save-load.t Thu Jan 27 20:30:33 2011
@@ -4,6 +4,7 @@
 
 use CPAN::Meta;
 use File::Temp 0.20 ();
+use Parse::CPAN::Meta 1.4200;
 
 my $distmeta = {
   name     => 'Module-Build',
@@ -77,11 +78,11 @@
 $meta->save($metafile);
 ok( -f $metafile, "save meta to file" );
 
-ok( $meta = CPAN::Meta->_load_file($metafile), 'load saved file' );
+ok( $meta = Parse::CPAN::Meta->load_file($metafile), 'load saved file' );
 is($meta->{name},     'Module-Build', 'name correct');
 
 
-ok( $meta = CPAN::Meta->_load_file('t/data/META-1_4.yml'), 'load META-1.4' );
+ok( $meta = Parse::CPAN::Meta->load_file('t/data/META-1_4.yml'), 'load META-1.4' );
 is($meta->{name},     'Module-Build', 'name correct');
 
 done_testing;

Modified: trunk/libcpan-meta-perl/t/validator.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libcpan-meta-perl/t/validator.t?rev=67951&op=diff
==============================================================================
--- trunk/libcpan-meta-perl/t/validator.t (original)
+++ trunk/libcpan-meta-perl/t/validator.t Thu Jan 27 20:30:33 2011
@@ -6,13 +6,14 @@
 use CPAN::Meta::Validator;
 use File::Spec;
 use IO::Dir;
+use Parse::CPAN::Meta 1.4200;
 
 {
   my $data_dir = IO::Dir->new( 't/data' );
   my @files = sort grep { /^\w/ } $data_dir->read;
 
   for my $f ( @files ) {
-    my $meta = CPAN::Meta->_load_file( File::Spec->catfile('t','data',$f) );
+    my $meta = Parse::CPAN::Meta->load_file( File::Spec->catfile('t','data',$f) );
     my $cmv = CPAN::Meta::Validator->new({%$meta});
     ok( $cmv->is_valid, "$f validates" )
       or diag( "ERRORS:\n" . join( "\n", $cmv->errors ) );
@@ -24,7 +25,7 @@
   my @files = sort grep { /^\w/ } $data_dir->read;
 
   for my $f ( @files ) {
-    my $meta = CPAN::Meta->_load_file( File::Spec->catfile('t','data-fail',$f) );
+    my $meta = Parse::CPAN::Meta->load_file( File::Spec->catfile('t','data-fail',$f) );
     my $cmv = CPAN::Meta::Validator->new({%$meta});
     ok( ! $cmv->is_valid, "invalid $f doesn't validate" );
   }




More information about the Pkg-perl-cvs-commits mailing list