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