This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
yet another 2 leaks. example for the second:
[perl5.git] / configpm
index 7816c8d..f232c9b 100755 (executable)
--- a/configpm
+++ b/configpm
@@ -118,7 +118,7 @@ sub fetch_string {
     my $quote_type = "'";
     my $marker = "$key=";
 
-    # Check for the common case, ' delimeted
+    # Check for the common case, ' delimited
     my $start = index($Config_SH, "\n$marker$quote_type");
     # If that failed, check for " delimited
     if ($start == -1) {
@@ -213,21 +213,24 @@ close CONFIG_SH;
 print CONFIG @non_v, "\n";
 
 # copy config summary format from the myconfig.SH script
-print CONFIG "my \$summary = <<'!END!';\n";
+print CONFIG "our \$summary : unique = <<'!END!';\n";
 open(MYCONFIG,"<myconfig.SH") || die "open myconfig.SH failed: $!";
 1 while defined($_ = <MYCONFIG>) && !/^Summary of/;
 do { print CONFIG $_ } until !defined($_ = <MYCONFIG>) || /^\s*$/;
 close(MYCONFIG);
 
+# NB. as $summary is unique, we need to copy it in a lexical variable
+# before expanding it, because may have been made readonly if a perl
+# interpreter has been cloned.
+
 print CONFIG "\n!END!\n", <<'EOT';
-my $summary_expanded = 0;
+my $summary_expanded;
 
 sub myconfig {
-    return $summary if $summary_expanded;
-    $summary =~ s{\$(\w+)}
+    return $summary_expanded if $summary_expanded;
+    ($summary_expanded = $summary) =~ s{\$(\w+)}
                 { my $c = $Config{$1}; defined($c) ? $c : 'undef' }ge;
-    $summary_expanded = 1;
-    $summary;
+    $summary_expanded;
 }
 
 our $Config_SH : unique = <<'!END!';
@@ -326,7 +329,7 @@ sub config_sh {
 
 sub config_re {
     my $re = shift;
-    return map { chomp; $_ } grep /^$re=/, split /^/, $config_sh;
+    return map { chomp; $_ } grep /^$re=/, split /^/, $Config_SH;
 }
 
 sub config_vars {
@@ -406,7 +409,7 @@ EOT
 }
 
 my $fast_config = join '', map { "    $_,\n" }
-    values (%v_fast), 'byteorder => $value' ;
+    sort values (%v_fast), 'byteorder => $value' ;
 
 print CONFIG sprintf <<'ENDOFTIE', $byteorder_code, $fast_config;