In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/adc2cdfb25be1eb14544e149b2dfb199dcbbc06e?hp=631d564d55844d5113b56f53d7c2270cd0e6ef25>

- Log -----------------------------------------------------------------
commit adc2cdfb25be1eb14544e149b2dfb199dcbbc06e
Author: Chris 'BinGOs' Williams <[email protected]>
Date:   Sun Jan 4 19:09:11 2015 +0000

    Update Module-Metadata to CPAN version 1.000025
    
      [DELTA]
    
    1.000025  2015-01-04 18:56:00Z
      - evaluate version assignment in a clean environment, to fix assignment 
in a
        block (RT#101095)
-----------------------------------------------------------------------

Summary of changes:
 Porting/Maintainers.pl                      |  3 ++-
 cpan/Module-Metadata/lib/Module/Metadata.pm | 41 ++++++++++++-----------------
 cpan/Module-Metadata/t/contains_pod.t       |  2 +-
 cpan/Module-Metadata/t/metadata.t           | 18 ++++++++++++-
 cpan/Module-Metadata/t/version.t            |  9 ++++---
 5 files changed, 42 insertions(+), 31 deletions(-)

diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index 279cffa..6a140cb 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -812,11 +812,12 @@ use File::Glob qw(:case);
     },
 
     'Module::Metadata' => {
-        'DISTRIBUTION' => 'ETHER/Module-Metadata-1.000024.tar.gz',
+        'DISTRIBUTION' => 'ETHER/Module-Metadata-1.000025.tar.gz',
         'FILES'        => q[cpan/Module-Metadata],
         'EXCLUDED'     => [
             qw(README.md),
             qw(t/00-report-prereqs.t),
+            qw(t/00-report-prereqs.dd),
             qr{^xt},
         ],
     },
diff --git a/cpan/Module-Metadata/lib/Module/Metadata.pm 
b/cpan/Module-Metadata/lib/Module/Metadata.pm
index a5d0fba..dddfedb 100644
--- a/cpan/Module-Metadata/lib/Module/Metadata.pm
+++ b/cpan/Module-Metadata/lib/Module/Metadata.pm
@@ -1,11 +1,6 @@
 # -*- mode: cperl; tab-width: 8; indent-tabs-mode: nil; basic-offset: 2 -*-
 # vim:ts=8:sw=2:et:sta:sts=2
-package Module::Metadata;
-BEGIN {
-  $Module::Metadata::AUTHORITY = 'cpan:MSTROUT';
-}
-# git description: v1.000023-1-g6bfd8b6
-$Module::Metadata::VERSION = '1.000024';
+package Module::Metadata; # git description: v1.000024-12-g978f25c
 
 # Adapted from Perl-licensed code originally distributed with
 # Module-Build by Ken Williams
@@ -14,9 +9,12 @@ $Module::Metadata::VERSION = '1.000024';
 # perl modules (assuming this may be expanded in the distant
 # parrot future to look at other types of modules).
 
+sub __clean_eval { eval $_[0] }
 use strict;
 use warnings;
 
+our $VERSION = '1.000025';
+
 use Carp qw/croak/;
 use File::Spec;
 BEGIN {
@@ -642,41 +640,36 @@ sub _evaluate_version_line {
   my $self = shift;
   my( $sigil, $variable_name, $line ) = @_;
 
-  # Some of this code came from the ExtUtils:: hierarchy.
-
-  # We compile into $vsub because 'use version' would cause
+  # We compile into a local sub because 'use version' would cause
   # compiletime/runtime issues with local()
-  my $vsub;
   $pn++; # everybody gets their own package
-  my $eval = qq{BEGIN { my \$dummy = q#  Hide from _packages_inside()
-    #; package Module::Metadata::_version::p$pn;
+  my $eval = qq{ my \$dummy = q#  Hide from _packages_inside()
+    #; package Module::Metadata::_version::p${pn};
     use version;
-    no strict;
-    no warnings;
-
-      \$vsub = sub {
-        local $sigil$variable_name;
-        \$$variable_name=undef;
-        $line;
-        \$$variable_name
-      };
-  }};
+    sub {
+      local $sigil$variable_name;
+      $line;
+      \$$variable_name
+    };
+  };
 
   $eval = $1 if $eval =~ m{^(.+)}s;
 
   local $^W;
   # Try to get the $VERSION
-  eval $eval;
+  my $vsub = __clean_eval($eval);
   # some modules say $VERSION <equal sign> $Foo::Bar::VERSION, but Foo::Bar 
isn't
   # installed, so we need to hunt in ./lib for it
   if ( $@ =~ /Can't locate/ && -d 'lib' ) {
     local @INC = ('lib',@INC);
-    eval $eval;
+    $vsub = __clean_eval($eval);
   }
   warn "Error evaling version line '$eval' in $self->{filename}: $@\n"
     if $@;
+
   (ref($vsub) eq 'CODE') or
     croak "failed to build version sub for $self->{filename}";
+
   my $result = eval { $vsub->() };
   # FIXME: $eval is not the right thing to print here
   croak "Could not get version from $self->{filename} by 
executing:\n$eval\n\nThe fatal error was: $@\n"
diff --git a/cpan/Module-Metadata/t/contains_pod.t 
b/cpan/Module-Metadata/t/contains_pod.t
index 5297123..016e784 100644
--- a/cpan/Module-Metadata/t/contains_pod.t
+++ b/cpan/Module-Metadata/t/contains_pod.t
@@ -8,7 +8,7 @@ BEGIN {
     ? require IO::Scalar && sub ($) {
       IO::Scalar->new(\$_[0]);
     }
-    # hide in n eval'd string so Perl::MinimumVersion doesn't clutch its pearls
+    # hide in an eval'd string so Perl::MinimumVersion doesn't clutch its 
pearls
     : eval <<'EVAL'
     sub ($) {
       open my $fh, '<', \$_[0];
diff --git a/cpan/Module-Metadata/t/metadata.t 
b/cpan/Module-Metadata/t/metadata.t
index 0a066fc..3d55111 100644
--- a/cpan/Module-Metadata/t/metadata.t
+++ b/cpan/Module-Metadata/t/metadata.t
@@ -221,6 +221,22 @@ package Simple;
   our ($VERSION)    = ($CVSVERSION =~ /(\d+\.\d+)/);
 }
 ---
+  'v2.2.102.2' => <<'---', # our + bare v-string
+package Simple;
+our $VERSION     = v2.2.102.2;
+---
+  '0.0.9_1' => <<'---', # our + dev release
+package Simple;
+our $VERSION = "0.0.9_1";
+---
+  '1.12' => <<'---', # our + crazy string and substitution code
+package Simple;
+our $VERSION     = '1.12.B55J2qn'; our $WTF = $VERSION; $WTF =~ 
s/^\d+\.\d+\.//; # attempts to rationalize $WTF go here.
+---
+  '1.12' => <<'---', # our in braces, as in Dist::Zilla::Plugin::PkgVersion 
with use_our = 1
+package Simple;
+{ our $VERSION = '1.12'; }
+---
 );
 
 # format: expected package name => code snippet
@@ -284,7 +300,7 @@ BEGIN {
   sub original_cwd { return $cwd }
 }
 
-# Setup a temp directory
+# Set up a temp directory
 sub tmpdir {
   my (@args) = @_;
   my $dir = $ENV{PERL_CORE} ? original_cwd : File::Spec->tmpdir;
diff --git a/cpan/Module-Metadata/t/version.t b/cpan/Module-Metadata/t/version.t
index e523f97..f97a19d 100644
--- a/cpan/Module-Metadata/t/version.t
+++ b/cpan/Module-Metadata/t/version.t
@@ -7,14 +7,15 @@ use lib "t/lib/0_2";
 plan tests => 4;
 
 require Foo;
-is $Foo::VERSION, 0.2;
+is($Foo::VERSION, 0.2, 'affirmed version of loaded module');
 
 my $meta = Module::Metadata->new_from_module("Foo", inc => [ "t/lib/0_1" ] );
-is $meta->version, 0.1;
+is($meta->version, 0.1, 'extracted proper version from scanned module');
 
-is $Foo::VERSION, 0.2;
+is($Foo::VERSION, 0.2, 'loaded module still retains its version');
 
-ok eval "use Foo 0.2; 1";
+ok(eval "use Foo 0.2; 1", 'successfully loaded module again')
+    or diag 'got exception: ', $@;
 
 
 

--
Perl5 Master Repository

Reply via email to