Author: kwilliams
Date: Mon Oct  2 09:20:37 2006
New Revision: 7865

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

Log:
Try squashing the 'argument list too long' bug, again...

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 Mon Oct  2 09:20:37 2006
@@ -3971,12 +3971,14 @@
   my ($self, @cmd) = @_;
   $self->log_info("@cmd\n");
 
-#  my %seen;
-#  my $sep = ref($self) ? $self->config('path_sep') : $Config{path_sep};
-#  local $ENV{PERL5LIB} = join $sep, grep {
-#    ! $seen{$_}++ and -d $_
-#  } split($sep, $ENV{PERL5LIB});
-
+  # Some systems proliferate huge PERL5LIBs, try to ameliorate:
+  my %seen;
+  my $sep = ref($self) ? $self->config('path_sep') : $Config{path_sep};
+  local $ENV{PERL5LIB} = 
+    ( length($ENV{PERL5LIB}) < 200
+      ? $ENV{PERL5LIB}
+      : join $sep, grep { ! $seen{$_}++ and -d $_ } split($sep, $ENV{PERL5LIB})
+    );
 
   my $status = system(@cmd);
   if ($status and $! =~ /Argument list too long/i) {

Modified: Module-Build/trunk/t/ext.t
==============================================================================
--- Module-Build/trunk/t/ext.t  (original)
+++ Module-Build/trunk/t/ext.t  Mon Oct  2 09:20:37 2006
@@ -95,9 +95,12 @@
 
 {
   # Make sure run_perl_script() propagates @INC
-  local @INC = ('whosiewhatzit', @INC);
+  my $dir = 'whosiewhatzit';
+  mkdir $dir, 0777;
+  local @INC = ($dir, @INC);
   my $output = stdout_of( sub { Module::Build->run_perl_script('', ['-le', 
'print for @INC']) } );
-  like $output, qr{^whosiewhatzit}m;
+  like $output, qr{^$dir}m;
+  rmdir $dir;
 }
 
 ##################################################################

Reply via email to