Skip to content

Commit

Permalink
Emit the truth about PERL_VERSION in %Config
Browse files Browse the repository at this point in the history
  • Loading branch information
toddr committed Jul 31, 2020
1 parent 77b11c8 commit 23dfe56
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions configpm
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ i_time='define'
prototype='define'
EOT

# Don't lie about PATCHLEVEL and SUBVERSION in %Config
push @v_others, "PATCHLEVEL='$^V->{version}->[1]'\n";
push @v_others, "SUBVERSION='$^V->{version}->[2]'\n";

my %seen_quotes;
{
Expand All @@ -237,18 +240,10 @@ my %seen_quotes;
s/^(\w+)=(true|\d+)\s*$/$1='$2'\n/ or m/^(\w+)='(.*)'$/;
my($k, $v) = ($1, $2);

# grandfather PATCHLEVEL and SUBVERSION and CONFIG
if ($k) {
if ($k eq 'PERL_VERSION') {
push @v_others, "PATCHLEVEL='$v'\n";
}
elsif ($k eq 'PERL_SUBVERSION') {
push @v_others, "SUBVERSION='$v'\n";
}
elsif ($k eq 'PERL_CONFIG_SH') {
# grandfather CONFIG
if ($k && $k eq 'PERL_CONFIG_SH') {
push @v_others, "CONFIG='$v'\n";
}
}

# We can delimit things in config.sh with either ' or ".
unless ($in_v or m/^(\w+)=(['"])(.*\n)/){
Expand All @@ -272,6 +267,17 @@ my %seen_quotes;

$val =~ s/$quote\n?\z//;

# Don't lie about PERL_VERSION variables in %Config
if( $k eq 'PERL_VERSION') {
$val = $^V->{version}->[1];
}
elsif ($k eq 'PERL_SUBVERSION') {
$val = $^V->{version}->[2];
}
elsif ($k eq 'PERL_REVISION') {
$val = $^V->{version}->[0];
}

my $line = "$name=$quote$val$quote\n";
push(@v_others, $line);
$seen_quotes{$quote}++;
Expand Down

0 comments on commit 23dfe56

Please sign in to comment.