1Probe::Perl(3) User Contributed Perl Documentation Probe::Perl(3)
2
3
4
6 Probe::Perl - Information about the currently running perl
7
9 version 0.03
10
12 use Probe::Perl;
13 $p = Probe::Perl->new();
14
15 # Version of this perl as a floating point number
16 $ver = $p->perl_version();
17 $ver = Probe::Perl->perl_version();
18
19 # Convert a multi-dotted string to a floating point number
20 $ver = $p->perl_version_to_float($ver);
21 $ver = Probe::Perl->perl_version_to_float($ver);
22
23 # Check if the given perl is the same as the one currently running
24 $bool = $p->perl_is_same($perl_path);
25 $bool = Probe::Perl->perl_is_same($perl_path);
26
27 # Find a path to the currently-running perl
28 $path = $p->find_perl_interpreter();
29 $path = Probe::Perl->find_perl_interpreter();
30
31 # Get @INC before run-time additions
32 @paths = $p->perl_inc();
33 @paths = Probe::Perl->perl_inc();
34
35 # Get the general type of operating system
36 $type = $p->os_type();
37 $type = Probe::Perl->os_type();
38
39 # Access Config.pm values
40 $val = $p->config('foo');
41 $val = Probe::Perl->config('foo');
42 $p->config('foo' => 'bar'); # Set locally
43 $p->config_revert('foo'); # Revert
44
46 This module provides methods for obtaining information about the
47 currently running perl interpreter. It originally began life as code
48 in the "Module::Build" project, but has been externalized here for
49 general use.
50
52 new()
53 Creates a new Probe::Perl object and returns it. Most methods in
54 the Probe::Perl packages are available as class methods, so you
55 don't always need to create a new object. But if you want to
56 create a mutable view of the "Config.pm" data, it's necessary to
57 create an object to store the values in.
58
59 config( $key [, $value] )
60 Returns the "Config.pm" value associated with $key. If $value is
61 also specified, then the value is set to $value for this view of
62 the data. In this case, "config()" must be called as an object
63 method, not a class method.
64
65 config_revert( $key )
66 Removes any user-assigned value in this view of the "Config.pm"
67 data.
68
69 find_perl_interpreter( )
70 Returns the absolute path of this perl interpreter. This is
71 actually sort of a tricky thing to discover sometimes - in these
72 cases we use "perl_is_same()" to verify.
73
74 perl_version( )
75 Returns the version of this perl interpreter as a perl-styled
76 version number using "perl_version_to_float()". Uses $^V if your
77 perl is recent enough, otherwise uses $].
78
79 perl_version_to_float( $version )
80 Formats $version as a perl-styled version number like 5.008001.
81
82 perl_is_same( $perl )
83 Given the name of a perl interpreter, this method determines if it
84 has the same configuration as the one represented by the current
85 perl instance. Usually this means it's exactly the same
86
87 perl_inc( )
88 Returns a list of directories in this perl's @INC path, before any
89 entries from "use lib", $ENV{PERL5LIB}, or "-I" switches are added.
90
91 os_type( [$osname] )
92 Returns a generic OS type (e.g. "Unix", "Windows", "MacOS") for the
93 given OS name. If no OS name is given it uses the value in $^O,
94 which is the same as $Config{osname}.
95
97 Randy W. Sims <randys@thepierianspring.org>
98
99 Based partly on code from the Module::Build project, by Ken Williams
100 <kwilliams@cpan.org> and others.
101
103 Copyright 2005 Ken Williams and Randy Sims. All rights reserved.
104
105 This library is free software; you can redistribute it and/or modify it
106 under the same terms as Perl itself.
107
108
109
110perl v5.30.0 2019-07-26 Probe::Perl(3)