Skip to content

Commit 23dfe56

Browse files
committed
Emit the truth about PERL_VERSION in %Config
1 parent 77b11c8 commit 23dfe56

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

configpm

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ i_time='define'
225225
prototype='define'
226226
EOT
227227

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

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

240-
# grandfather PATCHLEVEL and SUBVERSION and CONFIG
241-
if ($k) {
242-
if ($k eq 'PERL_VERSION') {
243-
push @v_others, "PATCHLEVEL='$v'\n";
244-
}
245-
elsif ($k eq 'PERL_SUBVERSION') {
246-
push @v_others, "SUBVERSION='$v'\n";
247-
}
248-
elsif ($k eq 'PERL_CONFIG_SH') {
243+
# grandfather CONFIG
244+
if ($k && $k eq 'PERL_CONFIG_SH') {
249245
push @v_others, "CONFIG='$v'\n";
250246
}
251-
}
252247

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

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

270+
# Don't lie about PERL_VERSION variables in %Config
271+
if( $k eq 'PERL_VERSION') {
272+
$val = $^V->{version}->[1];
273+
}
274+
elsif ($k eq 'PERL_SUBVERSION') {
275+
$val = $^V->{version}->[2];
276+
}
277+
elsif ($k eq 'PERL_REVISION') {
278+
$val = $^V->{version}->[0];
279+
}
280+
275281
my $line = "$name=$quote$val$quote\n";
276282
push(@v_others, $line);
277283
$seen_quotes{$quote}++;

0 commit comments

Comments
 (0)