summaryrefslogtreecommitdiff
path: root/configpm
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2011-02-17 16:25:53 +0000
committerNicholas Clark <nick@ccl4.org>2011-02-17 16:28:36 +0000
commit3acb769b7e0a362f74c892536b04646fe37d0929 (patch)
tree237f78b31164a5e818c616fa2aa0fe84e4efe126 /configpm
parentc6b7b56c8549a3570120ea861853b7f5cbb02733 (diff)
downloadperl-3acb769b7e0a362f74c892536b04646fe37d0929.tar.gz
Add functions to Config to expose the remaining information from perl -V
Previously one could only find out by parsing the output of perl -V the list of local patches, the compilation date, and the compilation options (some of which affect binary compatibility). Now provide all of these as local_patches(), compile_date(), bincompat_options() and non_bincompat_options().
Diffstat (limited to 'configpm')
-rwxr-xr-xconfigpm43
1 files changed, 42 insertions, 1 deletions
diff --git a/configpm b/configpm
index f08a194da9..5ca58c7312 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();
@@ -170,7 +187,9 @@ ENDOFBEG
my $export_funcs = <<'EOT';
my %Export_Cache = (myconfig => 1,
- config_sh => 1, config_vars => 1, config_re => 1);
+ config_sh => 1, config_vars => 1, config_re => 1,
+ bincompat_options => 1, non_bincompat_options => 1,
+ compile_date => 1, local_patches => 1);
EOT
my %export_ok = eval $export_funcs or die;
@@ -845,6 +864,28 @@ printed on a separate line in the form:
Names which are unknown are output as C<name='UNKNOWN';>.
See also C<-V:name> in L<perlrun/Switches>.
+=item bincompat_options()
+
+Returns a list of C pre-processor options used when compiling this F<perl>
+binary, which affect its binary compatibility with extensions.
+C<bincompat_options()> and C<non_bincompat_options()> are shown together in
+the output of C<perl -V> as I<Compile-time options>.
+
+=item non_bincompat_options()
+
+Returns a list of C pre-processor options used when compiling this F<perl>
+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<perl -V>
+
+=item local_patches()
+
+Returns a list of the names of locally applied patches, equivalent to what
+is shown by C<perl -V>.
+
=back
=head1 EXAMPLE