[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[PATCH] Fix for lib.pm Config detection



Hi,

I was just about to upload lib to CPAN when I found a rather 
embarrassing bug in the recent patch submitted to p5p. It causes broken 
lib.pm to be generated if

- the paths are incorporated at compile time
- and there are previous versions included.

Therefore, this won't show up in blead until 5.1X.1 is released.

Sorry! Patch attached.

Cheers,
Steffen

P.S.: Also, please forgive the one-line style change, but it entirely 
screwed up syntax highlighting for me.
--- lib/lib_pm.PL.orig	2008-06-01 12:46:16.000000000 +0200
+++ lib/lib_pm.PL	2008-06-01 17:31:51.000000000 +0200
@@ -6,7 +6,7 @@
 my $origdir = cwd;
 chdir dirname($0);
 my $file = basename($0, '.PL');
-$file =~ s!_(pm)$!.$1!i;
+$file =~ s/_(pm)$/.$1/i;
 
 my $useConfig;
 my $Config_archname;
@@ -31,14 +31,15 @@
   open my $fh, '<', $lib_file
     or die "Could not open file '$lib_file' for reading: $!";
   my $ConfigRegex = qr/(?:use|require)\s+Config(?:\s+|;)/;
+  my $found_config = 0;
   while (defined($_ = <$fh>)) {
     # crude heuristics to check that we were using Config
     if (/^\s*$ConfigRegex/ || /^\s*eval.*$ConfigRegex/) {
-      $expand_config_vars = 0;
+      $found_config = 1;
       last;
     }
   }
-  $expand_config_vars = 1;
+  $expand_config_vars = $found_config ? 0 : 1;
 HERE
   $expand_config_vars = 0 if $@;
 }
@@ -51,7 +52,7 @@
 	reverse split / /, $Config{inc_version_list};
     $Config_inc_version_list =
 	@Config_inc_version_list ?
-	    qq(@Config_inc_version_list) : q(());
+	    qq(qw(@Config_inc_version_list)) : q(());
 } else {
     $useConfig = 'use Config;';
     $Config_archname = q($Config{archname});

Follow-Ups from:
"Rafael Garcia-Suarez" <rgarciasuarez@gmail.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]