X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/d50f1408338c986819086d7001a554dcd41e31f5..3acb769b7e0a362f74c892536b04646fe37d0929:/configpm diff --git a/configpm b/configpm index cad3a9a..5ca58c7 100755 --- a/configpm +++ b/configpm @@ -128,6 +128,23 @@ use strict; # use warnings; Pulls in Carp # use vars pulls in Carp +sub bincompat_options { + return sort split ' ', (Internals::V())[0]; +} + +sub non_bincompat_options { + return sort split ' ', (Internals::V())[1]; +} + +sub compile_date { + return (Internals::V())[2] +} + +sub local_patches { + my (undef, undef, undef, @patches) = Internals::V(); + return @patches; +} + sub _V { my ($bincompat, $non_bincompat, $date, @patches) = Internals::V(); @@ -168,9 +185,16 @@ sub _V { ENDOFBEG -my $myver = sprintf "%vd", $^V; +my $export_funcs = <<'EOT'; +my %Export_Cache = (myconfig => 1, + config_sh => 1, config_vars => 1, config_re => 1, + bincompat_options => 1, non_bincompat_options => 1, + compile_date => 1, local_patches => 1); +EOT -$config_txt .= sprintf <<'ENDOFBEG', ($myver) x 3; +my %export_ok = eval $export_funcs or die; + +$config_txt .= sprintf << 'EOT', $export_funcs; # This file was created by configpm when Perl was built. Any changes # made to this file will be lost the next time perl is built. @@ -182,22 +206,24 @@ package Config; use strict; # use warnings; Pulls in Carp # use vars pulls in Carp + +# Skip @Config::EXPORT because it only contains %%Config, which we special +# case below as it's not a function. @Config::EXPORT won't change in the +# lifetime of Perl 5. +%s @Config::EXPORT = qw(%%Config); -@Config::EXPORT_OK = qw(myconfig config_sh config_vars config_re); +@Config::EXPORT_OK = keys %%Export_Cache; # Need to stub all the functions to make code such as print Config::config_sh # keep working -sub myconfig; -sub config_sh; -sub config_vars; -sub config_re; +EOT -# Skip @Config::EXPORT because it only contains %%Config, which we special -# case below as it's not a function. @Config::EXPORT won't change in the -# lifetime of Perl 5. -my %%Export_Cache = map {($_ => 1)} @Config::EXPORT_OK; +$config_txt .= "sub $_;\n" foreach sort keys %export_ok; +my $myver = sprintf "%vd", $^V; + +$config_txt .= sprintf <<'ENDOFBEG', ($myver) x 3; our %%Config; # Define our own import method to avoid pulling in the full Exporter: @@ -838,6 +864,28 @@ printed on a separate line in the form: Names which are unknown are output as C. See also C<-V:name> in L. +=item bincompat_options() + +Returns a list of C pre-processor options used when compiling this F +binary, which affect its binary compatibility with extensions. +C and C are shown together in +the output of C as I. + +=item non_bincompat_options() + +Returns a list of C pre-processor options used when compiling this F +binary, which do not affect binary compatibility with extensions. + +=item compile_date() + +Returns the compile date (as a string), equivalent to what is shown by +C + +=item local_patches() + +Returns a list of the names of locally applied patches, equivalent to what +is shown by C. + =back =head1 EXAMPLE