Author: BINGOS
Date: Wed Nov 18 04:38:16 2009
New Revision: 13552

Modified:
   CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build.pm
   CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build/Constants.pm

Log:
Make the prereq resolving fallback to _build/ querying if the 'prereq_data' 
action fails.

The edge-case of a distribution that is bundling an older version of 
Module::Build exposed this
flaw. Thanks to Johan Vromans for questioning the test report for EekBoek.

Modified: CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build.pm
==============================================================================
--- CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build.pm        (original)
+++ CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build.pm        Wed Nov 18 
04:38:16 2009
@@ -30,7 +30,7 @@
 
 local $Params::Check::VERBOSE = 1;
 
-$VERSION = '0.42';
+$VERSION = '0.44';
 
 =pod
 
@@ -384,7 +384,8 @@
     else {
       my $safe_ver = version->new('0.31_03');
       my $content;
-      if ( version->new( $Module::Build::VERSION ) >= $safe_ver and 
IPC::Cmd->can_capture_buffer ) {
+      PREREQS: {
+        if ( version->new( $Module::Build::VERSION ) >= $safe_ver and 
IPC::Cmd->can_capture_buffer ) {
           my @buildflags = $dist->_buildflags_as_list( $buildflags );
 
           # Use the new Build action 'prereq_data'
@@ -395,7 +396,10 @@
                                 verbose => 0 ) 
           ) {
             error( loc( "Build 'prereq_data' failed: %1 %2", $!, $content ) );
-            return;
+            #return;
+          }
+          else {
+            last PREREQS;
           }
 
         }
@@ -412,14 +416,15 @@
         
           $content = do { local $/; <$fh> };
         }
+      }
 
-        return unless $content;
-        my $bphash = eval $content;
-        return unless $bphash and ref $bphash eq 'HASH';
-        foreach my $type ('requires', 'build_requires') {
-          next unless $bphash->{$type} and ref $bphash->{$type} eq 'HASH';
-          $prereqs->{$_} = $bphash->{$type}->{$_} for keys %{ $bphash->{$type} 
};
-        }
+      return unless $content;
+      my $bphash = eval $content;
+      return unless $bphash and ref $bphash eq 'HASH';
+      foreach my $type ('requires', 'build_requires') {
+        next unless $bphash->{$type} and ref $bphash->{$type} eq 'HASH';
+        $prereqs->{$_} = $bphash->{$type}->{$_} for keys %{ $bphash->{$type} };
+      }
     }
     # Temporary fix
     delete $prereqs->{'perl'};

Modified: CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build/Constants.pm
==============================================================================
--- CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build/Constants.pm      
(original)
+++ CPANPLUS-Dist-Build/trunk/lib/CPANPLUS/Dist/Build/Constants.pm      Wed Nov 
18 04:38:16 2009
@@ -9,7 +9,7 @@
     require Exporter;
     use vars    qw[$VERSION @ISA @EXPORT];
   
-    $VERSION    = '0.42';
+    $VERSION    = '0.44';
     @ISA        = qw[Exporter];
     @EXPORT     = qw[ BUILD_DIR BUILD ];
 }

Reply via email to