In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/d5fbd9dd00e27f435423fd4898ed0e5804de0fd6?hp=30029c0df8faaccb9dd387138c6d8545f7c45052>

- Log -----------------------------------------------------------------
commit d5fbd9dd00e27f435423fd4898ed0e5804de0fd6
Author: Nicholas Clark <[email protected]>
Date:   Fri Dec 17 17:18:33 2010 +0000

    Refactor ExtUtils::Constant's tests to pass cleanly on older versions.
    
    Work round bugs with the value of ~0 on 5.005 built on 64 bit systems.
    Convert @INC to absolute paths on 5.6.x so that
    ExtUtils::Constant::Aaargh56Hash will load from blib.
    Remove $runperl, which is no longer needed.

M       cpan/ExtUtils-Constant/t/Constant.t

commit 3e92488813b7b571b0de139f466ad8ec01152995
Author: Nicholas Clark <[email protected]>
Date:   Fri Dec 17 17:16:46 2010 +0000

    Refactor ExtUtils::Constant::Utils backwards compatibility code.
    
    Avoid warnings from letting 5.005 even think about POSIX charclass constants
    in regexps, and use compile-time constants to enable backcompat features.

M       cpan/ExtUtils-Constant/lib/ExtUtils/Constant/Utils.pm
-----------------------------------------------------------------------

Summary of changes:
 .../lib/ExtUtils/Constant/Utils.pm                 |   36 +++++++++++---------
 cpan/ExtUtils-Constant/t/Constant.t                |   35 +++++++++++++------
 2 files changed, 44 insertions(+), 27 deletions(-)

diff --git a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/Utils.pm 
b/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/Utils.pm
index 016507c..9608256 100644
--- a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/Utils.pm
+++ b/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/Utils.pm
@@ -1,14 +1,16 @@
 package ExtUtils::Constant::Utils;
 
 use strict;
-use vars qw($VERSION @EXPORT_OK @ISA $is_perl56);
+use vars qw($VERSION @EXPORT_OK @ISA);
 use Carp;
 
 @ISA = 'Exporter';
 @EXPORT_OK = qw(C_stringify perl_stringify);
-$VERSION = '0.02';
+$VERSION = '0.03';
 
-$is_perl56 = ($] < 5.007 && $] > 5.005_50);
+use constant is_perl55 => ($] < 5.005_50);
+use constant is_perl56 => ($] < 5.007 && $] > 5.005_50);
+use constant is_sane_perl => $] > 5.007;
 
 =head1 NAME
 
@@ -46,7 +48,7 @@ sub C_stringify {
     if tr/\0-\377// != length;
   # grr 5.6.1 moreso because its regexps will break on data that happens to
   # be utf8, which includes my 8 bit test cases.
-  $_ = pack 'C*', unpack 'U*', $_ . pack 'U*' if $is_perl56;
+  $_ = pack 'C*', unpack 'U*', $_ . pack 'U*' if is_perl56;
   s/\\/\\\\/g;
   s/([\"\'])/\\$1/g;   # Grr. fix perl mode.
   s/\n/\\n/g;          # Ensure newlines don't end up in octal
@@ -54,15 +56,17 @@ sub C_stringify {
   s/\t/\\t/g;
   s/\f/\\f/g;
   s/\a/\\a/g;
-  if (ord('A') == 193) { # EBCDIC has no ^\0-\177 workalike.
-      s/([[:^print:]])/sprintf "\\%03o", ord $1/ge;
-  } else {
-      s/([^\0-\177])/sprintf "\\%03o", ord $1/ge;
-  }
-  unless ($] < 5.006) {
+  unless (is_perl55) {
     # This will elicit a warning on 5.005_03 about [: :] being reserved unless
     # I cheat
     my $cheat = '([[:^print:]])';
+
+    if (ord('A') == 193) { # EBCDIC has no ^\0-\177 workalike.
+      s/$cheat/sprintf "\\%03o", ord $1/ge;
+    } else {
+      s/([^\0-\177])/sprintf "\\%03o", ord $1/ge;
+    }
+
     s/$cheat/sprintf "\\%03o", ord $1/ge;
   } else {
     require POSIX;
@@ -89,10 +93,13 @@ sub perl_stringify {
   s/\t/\\t/g;
   s/\f/\\f/g;
   s/\a/\\a/g;
-  unless ($] < 5.006) {
-    if ($] > 5.007) {
+  unless (is_perl55) {
+    # This will elicit a warning on 5.005_03 about [: :] being reserved unless
+    # I cheat
+    my $cheat = '([[:^print:]])';
+    if (is_sane_perl) {
        if (ord('A') == 193) { # EBCDIC has no ^\0-\177 workalike.
-           s/([[:^print:]])/sprintf "\\x{%X}", ord $1/ge;
+           s/$cheat/sprintf "\\x{%X}", ord $1/ge;
        } else {
            s/([^\0-\177])/sprintf "\\x{%X}", ord $1/ge;
        }
@@ -107,9 +114,6 @@ sub perl_stringify {
       }
       $_ = $copy;
     }
-    # This will elicit a warning on 5.005_03 about [: :] being reserved unless
-    # I cheat
-    my $cheat = '([[:^print:]])';
     s/$cheat/sprintf "\\%03o", ord $1/ge;
   } else {
     # Turns out "\x{}" notation only arrived with 5.6
diff --git a/cpan/ExtUtils-Constant/t/Constant.t 
b/cpan/ExtUtils-Constant/t/Constant.t
index 5805387..5cc6f49 100644
--- a/cpan/ExtUtils-Constant/t/Constant.t
+++ b/cpan/ExtUtils-Constant/t/Constant.t
@@ -20,20 +20,19 @@ my $keep_files = 0;
 $| = 1;
 
 # Because were are going to be changing directory before running Makefile.PL
-my $perl = $^X;
 # 5.005 doesn't have new enough File::Spec to have rel2abs. But actually we
 # only need it when $^X isn't absolute, which is going to be 5.8.0 or later
 # (where ExtUtils::Constant is in the core, and tests against the uninstalled
 # perl)
-$perl = File::Spec->rel2abs ($perl) unless $] < 5.006;
+my $perl = $] < 5.006 ? $^X : File::Spec->rel2abs($^X);
 # ExtUtils::Constant::C_constant uses $^X inside a comment, and we want to
 # compare output to ensure that it is the same. We were probably run as ./perl
 # whereas we will run the child with the full path in $perl. So make $^X for
 # us the same as our child will see.
 $^X = $perl;
-my $lib = $ENV{PERL_CORE} ? '../../../lib' : '../../blib/lib';
-my $runperl = "$perl \"-I$lib\"";
-print "# perl=$perl\n";
+# 5.005 doesn't have rel2abs, but also doesn't need to load an uninstalled
+# module from blib
+...@inc = map {File::Spec->rel2abs($_)} @INC if $] < 5.007 && $] >= 5.006;
 
 my $make = $Config{make};
 $make = $ENV{MAKE} if exists $ENV{MAKE};
@@ -149,9 +148,9 @@ sub check_for_bonus_files {
 sub build_and_run {
   my ($tests, $expect, $files) = @_;
   my $core = $ENV{PERL_CORE} ? ' PERL_CORE=1' : '';
-  my @perlout = `$runperl Makefile.PL $core`;
+  my @perlout = `$perl Makefile.PL $core`;
   if ($?) {
-    print "not ok $realtest # $runperl Makefile.PL failed: $?\n";
+    print "not ok $realtest # $perl Makefile.PL failed: $?\n";
     print "# $_" foreach @perlout;
     exit($?);
   } else {
@@ -261,14 +260,14 @@ sub build_and_run {
              print REGENTMP $_ if $saw_shebang;
          }
          close XS;  close REGENTMP;
-         $regen = `$runperl regentmp`;
+         $regen = `$perl regentmp`;
          unlink 'regentmp';
       }
       else {
-         $regen = `$runperl -x $package.xs`;
+         $regen = `$perl -x $package.xs`;
       }
       if ($?) {
-         print "not ok $realtest # $runperl -x $package.xs failed: $?\n";
+         print "not ok $realtest # $perl -x $package.xs failed: $?\n";
          } else {
              print "ok $realtest - regen\n";
          }
@@ -636,15 +635,29 @@ if ($farthing == 0.25) {
 }
 $test++;
 
+EOT
+
+  my $cond;
+  if ($] >= 5.006 || $Config{longsize} < 8) {
+    $cond = '$not_zero > 0 && $not_zero == ~0';
+  } else {
+    $cond = q{pack 'Q', $not_zero eq ~pack 'Q', 0};
+  }
+
+  $test_body .= sprintf <<'EOT', $cond;
 # UV
 my $not_zero = NOT_ZERO;
-if ($not_zero > 0 && $not_zero == ~0) {
+if (%s) {
   print "ok $test\n";
 } else {
   print "not ok $test # \$not_zero=$not_zero ~0=" . (~0) . "\n";
 }
 $test++;
 
+EOT
+
+  $test_body .= <<'EOT';
+
 # Value includes a "*/" in an attempt to bust out of a C comment.
 # Also tests custom cpp #if clauses
 my $close = CLOSE;

--
Perl5 Master Repository

Reply via email to