Author: dagolden
Date: Thu Dec  3 20:12:26 2009
New Revision: 13632

Modified:
   Module-Build/trunk/Changes
   Module-Build/trunk/lib/Module/Build/Base.pm
   Module-Build/trunk/t/bundle_inc.t

Log:
protect against broken ExtUtils::Installed

Modified: Module-Build/trunk/Changes
==============================================================================
--- Module-Build/trunk/Changes  (original)
+++ Module-Build/trunk/Changes  Thu Dec  3 20:12:26 2009
@@ -1,6 +1,10 @@
 Revision history for Perl extension Module::Build.
 
-0.35_12 - 
+0.35_12 -
+
+ Bug fixes:
+
+ - Protect inc/ bundling tests against broken ExtUtils::Installed
 
 0.35_11 - Thu Dec  3 11:07:44 EST 2009
 

Modified: Module-Build/trunk/lib/Module/Build/Base.pm
==============================================================================
--- Module-Build/trunk/lib/Module/Build/Base.pm (original)
+++ Module-Build/trunk/lib/Module/Build/Base.pm Thu Dec  3 20:12:26 2009
@@ -1279,7 +1279,15 @@
     return unless inc::latest->can('loaded_modules');
     require ExtUtils::Installed;
     # ExtUtils::Installed is buggy about finding additions to default @INC
-    my $inst = ExtUtils::Installed->new(extra_libs => [...@inc]);
+    my $inst = eval { ExtUtils::Installed->new(extra_libs => [...@inc]) };
+    if ($@) {
+      $self->log_warn( << "EUI_ERROR" );
+Bundling in inc/ is disabled because ExtUtils::Installed could not
+create a list of your installed modules.  Here is the error:
+$@
+EUI_ERROR
+      return;
+    }
     my @bundle_list = map { [ $_, 0 ] } inc::latest->loaded_modules;
 
     # XXX TODO: Need to get ordering of prerequisites correct so they are

Modified: Module-Build/trunk/t/bundle_inc.t
==============================================================================
--- Module-Build/trunk/t/bundle_inc.t   (original)
+++ Module-Build/trunk/t/bundle_inc.t   Thu Dec  3 20:12:26 2009
@@ -8,6 +8,7 @@
 use IO::File;
 use File::Spec;
 use ExtUtils::Packlist;
+use ExtUtils::Installed;
 use File::Path;
 
 # Ensure any Module::Build modules are loaded from correct directory
@@ -17,6 +18,9 @@
 if ( $ENV{PERL_CORE} ) {
   plan skip_all => 'bundle_inc tests will never succeed in PERL_CORE';
 }
+elsif ( ! eval { ExtUtils::Installed->new(extra_libs => [...@inc]) } ) {
+  plan skip_all => 'ExtUtils::Installed had problems with your system';
+}
 elsif ( Module::Build::ConfigData->feature('inc_bundling_support') ) {
   plan tests => 18;
 } else {

Reply via email to