1V(3) User Contributed Perl Documentation V(3)
2
3
4
6 Config::Perl::V - Structured data retrieval of perl -V output
7
9 use Config::Perl::V;
10
11 my $local_config = Config::Perl::V::myconfig ();
12 print $local_config->{config}{osname};
13
15 $conf = myconfig ()
16 This function will collect the data described in "The hash structure"
17 below, and return that as a hash reference. It optionally accepts an
18 option to include more entries from %ENV. See "environment" below.
19
20 Note that this will not work on uninstalled perls when called with
21 "-I/path/to/uninstalled/perl/lib", but it works when that path is in
22 $PERL5LIB or in $PERL5OPT, as paths passed using "-I" are not known
23 when the "-V" information is collected.
24
25 $conf = plv2hash ($text [, ...])
26 Convert a sole 'perl -V' text block, or list of lines, to a complete
27 myconfig hash. All unknown entries are defaulted.
28
29 $info = summary ([$conf])
30 Return an arbitrary selection of the information. If no $conf is given,
31 "myconfig ()" is used instead.
32
33 $md5 = signature ([$conf])
34 Return the MD5 of the info returned by "summary ()" without the
35 "config_args" entry.
36
37 If "Digest::MD5" is not available, it return a string with only 0's.
38
39 The hash structure
40 The returned hash consists of 4 parts:
41
42 build
43 This information is extracted from the second block that is emitted
44 by "perl -V", and usually looks something like
45
46 Characteristics of this binary (from libperl):
47 Compile-time options: DEBUGGING USE_64_BIT_INT USE_LARGE_FILES
48 Locally applied patches:
49 defined-or
50 MAINT24637
51 Built under linux
52 Compiled at Jun 13 2005 10:44:20
53 @INC:
54 /usr/lib/perl5/5.8.7/i686-linux-64int
55 /usr/lib/perl5/5.8.7
56 /usr/lib/perl5/site_perl/5.8.7/i686-linux-64int
57 /usr/lib/perl5/site_perl/5.8.7
58 /usr/lib/perl5/site_perl
59 .
60
61 or
62
63 Characteristics of this binary (from libperl):
64 Compile-time options: DEBUGGING MULTIPLICITY
65 PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
66 PERL_MALLOC_WRAP PERL_TRACK_MEMPOOL
67 PERL_USE_SAFE_PUTENV USE_ITHREADS
68 USE_LARGE_FILES USE_PERLIO
69 USE_REENTRANT_API
70 Built under linux
71 Compiled at Jan 28 2009 15:26:59
72
73 This information is not available anywhere else, including %Config,
74 but it is the information that is only known to the perl binary.
75
76 The extracted information is stored in 5 entries in the "build"
77 hash:
78
79 osname
80 This is most likely the same as $Config{osname}, and was the
81 name known when perl was built. It might be different if perl
82 was cross-compiled.
83
84 The default for this field, if it cannot be extracted, is to
85 copy $Config{osname}. The two may be differing in casing
86 (OpenBSD vs openbsd).
87
88 stamp
89 This is the time string for which the perl binary was compiled.
90 The default value is 0.
91
92 options
93 This is a hash with all the known defines as keys. The value is
94 either 0, which means unknown or unset, or 1, which means
95 defined.
96
97 derived
98 As some variables are reported by a different name in the
99 output of "perl -V" than their actual name in %Config, I
100 decided to leave the "config" entry as close to reality as
101 possible, and put in the entries that might have been guessed
102 by the printed output in a separate block.
103
104 patches
105 This is a list of optionally locally applied patches. Default
106 is an empty list.
107
108 environment
109 By default this hash is only filled with the environment variables
110 out of %ENV that start with "PERL", but you can pass the "env"
111 option to myconfig to get more
112
113 my $conf = Config::Perl::V::myconfig ({ env => qr/^ORACLE/ });
114 my $conf = Config::Perl::V::myconfig ([ env => qr/^ORACLE/ ]);
115
116 config
117 This hash is filled with the variables that "perl -V" fills its
118 report with, and it has the same variables that "Config::myconfig"
119 returns from %Config.
120
121 inc This is the list of default @INC.
122
124 This module was written to be able to return the configuration for the
125 currently used perl as deeply as needed for the CPANTESTERS framework.
126 Up until now they used the output of myconfig as a single text blob,
127 and so it was missing the vital binary characteristics of the running
128 perl and the optional applied patches.
129
131 Please feedback what is wrong
132
134 * Implement retrieval functions/methods
135 * Documentation
136 * Error checking
137 * Tests
138
140 H.Merijn Brand <h.m.brand@xs4all.nl>
141
143 Copyright (C) 2009-2023 H.Merijn Brand
144
145 This library is free software; you can redistribute it and/or modify it
146 under the same terms as Perl itself.
147
148
149
150perl v5.36.0 2023-03-02 V(3)