summaryrefslogtreecommitdiffstats
path: root/upstream/mageia-cauldron/man3pm/Config::Perl::V.3pm
blob: e7bd9614e91f4cde8224b46a6d8ef515c1cd0df0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
.\" -*- mode: troff; coding: utf-8 -*-
.\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43)
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
.ie n \{\
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds C`
.    ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\"
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
.    if \nF \{\
.        de IX
.        tm Index:\\$1\t\\n%\t"\\$2"
..
.        if !\nF==2 \{\
.            nr % 0
.            nr F 2
.        \}
.    \}
.\}
.rr rF
.\" ========================================================================
.\"
.IX Title "Config::Perl::V 3pm"
.TH Config::Perl::V 3pm 2023-11-28 "perl v5.38.2" "Perl Programmers Reference Guide"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
.nh
.SH NAME
Config::Perl::V \- Structured data retrieval of perl \-V output
.SH SYNOPSIS
.IX Header "SYNOPSIS"
.Vb 1
\& use Config::Perl::V;
\&
\& my $local_config = Config::Perl::V::myconfig ();
\& print $local_config\->{config}{osname};
.Ve
.SH DESCRIPTION
.IX Header "DESCRIPTION"
.ie n .SS "$conf = myconfig ()"
.el .SS "\f(CW$conf\fP = myconfig ()"
.IX Subsection "$conf = myconfig ()"
This function will collect the data described in "The hash structure" below,
and return that as a hash reference. It optionally accepts an option to
include more entries from \f(CW%ENV\fR. See "environment" below.
.PP
Note that this will not work on uninstalled perls when called with
\&\f(CW\*(C`\-I/path/to/uninstalled/perl/lib\*(C'\fR, but it works when that path is in
\&\f(CW$PERL5LIB\fR or in \f(CW$PERL5OPT\fR, as paths passed using \f(CW\*(C`\-I\*(C'\fR are not
known when the \f(CW\*(C`\-V\*(C'\fR information is collected.
.ie n .SS "$conf = plv2hash ($text [, ...])"
.el .SS "\f(CW$conf\fP = plv2hash ($text [, ...])"
.IX Subsection "$conf = plv2hash ($text [, ...])"
Convert a sole 'perl \-V' text block, or list of lines, to a complete
myconfig hash.  All unknown entries are defaulted.
.ie n .SS "$info = summary ([$conf])"
.el .SS "\f(CW$info\fP = summary ([$conf])"
.IX Subsection "$info = summary ([$conf])"
Return an arbitrary selection of the information. If no \f(CW$conf\fR is
given, \f(CW\*(C`myconfig ()\*(C'\fR is used instead.
.ie n .SS "$md5 = signature ([$conf])"
.el .SS "\f(CW$md5\fP = signature ([$conf])"
.IX Subsection "$md5 = signature ([$conf])"
Return the MD5 of the info returned by \f(CW\*(C`summary ()\*(C'\fR without the
\&\f(CW\*(C`config_args\*(C'\fR entry.
.PP
If \f(CW\*(C`Digest::MD5\*(C'\fR is not available, it return a string with only \f(CW0\fR's.
.SS "The hash structure"
.IX Subsection "The hash structure"
The returned hash consists of 4 parts:
.IP build 4
.IX Item "build"
This information is extracted from the second block that is emitted by
\&\f(CW\*(C`perl \-V\*(C'\fR, and usually looks something like
.Sp
.Vb 10
\& Characteristics of this binary (from libperl):
\&   Compile\-time options: DEBUGGING USE_64_BIT_INT USE_LARGE_FILES
\&   Locally applied patches:
\&         defined\-or
\&         MAINT24637
\&   Built under linux
\&   Compiled at Jun 13 2005 10:44:20
\&   @INC:
\&     /usr/lib/perl5/5.8.7/i686\-linux\-64int
\&     /usr/lib/perl5/5.8.7
\&     /usr/lib/perl5/site_perl/5.8.7/i686\-linux\-64int
\&     /usr/lib/perl5/site_perl/5.8.7
\&     /usr/lib/perl5/site_perl
\&     .
.Ve
.Sp
or
.Sp
.Vb 9
\& Characteristics of this binary (from libperl):
\&   Compile\-time options: DEBUGGING MULTIPLICITY
\&                         PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
\&                         PERL_MALLOC_WRAP PERL_TRACK_MEMPOOL
\&                         PERL_USE_SAFE_PUTENV USE_ITHREADS
\&                         USE_LARGE_FILES USE_PERLIO
\&                         USE_REENTRANT_API
\&   Built under linux
\&   Compiled at Jan 28 2009 15:26:59
.Ve
.Sp
This information is not available anywhere else, including \f(CW%Config\fR,
but it is the information that is only known to the perl binary.
.Sp
The extracted information is stored in 5 entries in the \f(CW\*(C`build\*(C'\fR hash:
.RS 4
.IP osname 4
.IX Item "osname"
This is most likely the same as \f(CW$Config{osname}\fR, and was the name
known when perl was built. It might be different if perl was cross-compiled.
.Sp
The default for this field, if it cannot be extracted, is to copy
\&\f(CW$Config{osname}\fR. The two may be differing in casing (OpenBSD vs openbsd).
.IP stamp 4
.IX Item "stamp"
This is the time string for which the perl binary was compiled. The default
value is 0.
.IP options 4
.IX Item "options"
This is a hash with all the known defines as keys. The value is either 0,
which means unknown or unset, or 1, which means defined.
.IP derived 4
.IX Item "derived"
As some variables are reported by a different name in the output of \f(CW\*(C`perl \-V\*(C'\fR
than their actual name in \f(CW%Config\fR, I decided to leave the \f(CW\*(C`config\*(C'\fR entry
as close to reality as possible, and put in the entries that might have been
guessed by the printed output in a separate block.
.IP patches 4
.IX Item "patches"
This is a list of optionally locally applied patches. Default is an empty list.
.RE
.RS 4
.RE
.IP environment 4
.IX Item "environment"
By default this hash is only filled with the environment variables
out of \f(CW%ENV\fR that start with \f(CW\*(C`PERL\*(C'\fR, but you can pass the \f(CW\*(C`env\*(C'\fR option
to myconfig to get more
.Sp
.Vb 2
\& my $conf = Config::Perl::V::myconfig ({ env => qr/^ORACLE/ });
\& my $conf = Config::Perl::V::myconfig ([ env => qr/^ORACLE/ ]);
.Ve
.IP config 4
.IX Item "config"
This hash is filled with the variables that \f(CW\*(C`perl \-V\*(C'\fR fills its report
with, and it has the same variables that \f(CW\*(C`Config::myconfig\*(C'\fR returns
from \f(CW%Config\fR.
.IP inc 4
.IX Item "inc"
This is the list of default \f(CW@INC\fR.
.SH REASONING
.IX Header "REASONING"
This module was written to be able to return the configuration for the
currently used perl as deeply as needed for the CPANTESTERS framework.
Up until now they used the output of myconfig as a single text blob,
and so it was missing the vital binary characteristics of the running
perl and the optional applied patches.
.SH BUGS
.IX Header "BUGS"
Please feedback what is wrong
.SH TODO
.IX Header "TODO"
.Vb 4
\& * Implement retrieval functions/methods
\& * Documentation
\& * Error checking
\& * Tests
.Ve
.SH AUTHOR
.IX Header "AUTHOR"
H.Merijn Brand <h.m.brand@xs4all.nl>
.SH "COPYRIGHT AND LICENSE"
.IX Header "COPYRIGHT AND LICENSE"
Copyright (C) 2009\-2023 H.Merijn Brand
.PP
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.