3 package Config
::Perl
::V
;
12 # Characteristics of this binary (from libperl):
13 # Compile-time options: DEBUGGING PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
14 # USE_64_BIT_INT USE_LARGE_FILES USE_PERLIO
16 # The list are as the perl binary has stored it in PL_bincompat_options
18 # perl.c line 1768 (first block)
19 # perl.h line 4454 (second block),
20 my %BTD = map { $_ => 0 } qw(
30 PERL_MEM_LOG_TIMESTAMP
37 DEBUG_LEAKING_SCALARS_FORK_DUMP
42 PERL_DEBUG_READONLY_OPS
49 PERL_OLD_COPY_ON_WRITE
52 PERL_USES_PL_PIDSTATUS
69 # These are all the keys that are
70 # 1. Always present in %Config (first block)
71 # 2. Reported by 'perl -V' (the rest)
89 package revision version_patchlevel_string
91 osname osvers archname
94 hint useposix d_sigaction
95 useithreads usemultiplicity
96 useperlio d_sfio uselargefiles usesocks
97 use64bitint use64bitall uselongdouble
98 usemymalloc bincompat5005
103 ccversion gccversion gccosandvers
104 intsize longsize ptrsize doublesize byteorder
105 d_longlong longlongsize d_longdbl longdblsize
106 ivtype ivsize nvtype nvsize lseektype lseeksize
113 libc so useshrplib libperl
116 dlsrc dlext d_dlsymun ccdlflags
123 my %args = ref $args eq "HASH" ?
% $args :
124 ref $args eq "ARRAY" ?
%{@
$args} : ();
126 #y $pv = qx[$^X -e"sub Config::myconfig{};" -V];
128 $pv =~ s{.*?\n\n}{}s;
129 $pv =~ s{\n(?: \s+|\t\s*)}{ }g;
139 $pv =~ m{^\s+Built under (.*)}m and $build->{osname
} = $1;
140 $pv =~ m{^\s+Compiled at (.*)}m and $build->{stamp
} = $1;
141 $pv =~ m{^\s+Locally applied patches:\s+(.*)}m and $build->{patches
} = [ split m/\s+/, $1 ];
142 $pv =~ m{^\s+Compile-time options:\s+(.*)}m and map { $build->{options
}{$_} = 1 } split m/\s+/, $1;
144 my @KEYS = keys %ENV;
146 map { $_ => $ENV{$_} } grep m/^PERL/ => @ENV;
147 $args{db
} || $args{pg
} || $args{postgres
} and
148 map { $env{$_} = $ENV{$_} } grep m{^PG} => @KEYS;
149 $args{db
} || $args{oracle
} and
150 map { $env{$_} = $ENV{$_} } grep m{^ORACLE} => @KEYS;
151 $args{db
} || $args{mysql
} and
152 map { $env{$_} = $ENV{$_} } grep m{^M[yY]SQL} => @KEYS;
154 map { $env{$_} = $ENV{$_} } grep m{$args{env}} => @KEYS;
156 my %config = map { $_ => $Config{$_} } @config_vars;
160 environment
=> \
%env,
172 Config::Perl::V - Structured data retreival of perl -V output
178 my $local_config = Config::Perl::V::myconfig ();
179 print $local_config->{config}{osname};
185 Currently the only function. Documentation will follow.
189 This module was written to be able to return the configuration for the
190 currently used perl as deeply as needed for the CPANTESTERS framework.
191 Up until now they used the output of myconfig as a single text blob,
192 and so it was missing the vital binary characteristics of the running
193 perl and the optional applied patches.
197 Please feedback what is wrong
201 * Implement retreival functions/methods
202 * Document what is done and why
203 * Include the perl -V parse block from Andreas
207 H.Merijn Brand <h.m.brand@xs4all.nl>
209 =head1 COPYRIGHT AND LICENSE
211 Copyright (C) 1999-2009 H.Merijn Brand
213 This library is free software; you can redistribute it and/or modify
214 it under the same terms as Perl itself.