1Devel::CheckOS(3)     User Contributed Perl Documentation    Devel::CheckOS(3)
2
3
4

NAME

6       Devel::CheckOS - check what OS we're running on
7

DESCRIPTION

9       Devel::CheckOS provides a more friendly interface to $^O, and also lets
10       you check for various OS "families" such as "Unix", which includes
11       things like Linux, Solaris, AIX etc.
12

SYNOPSIS

14           use Devel::CheckOS qw(os_is);
15           print "Hey, I know this, it's a Unix system\n" if(os_is('Unix'));
16
17           print "You've got Linux 2.6\n" if(os_is('Linux::v2_6'));
18

USING IT IN Makefile.PL or Build.PL

20       If you want to use this from Makefile.PL or Build.PL, do not simply
21       copy the module into your distribution as this may cause problems when
22       PAUSE and search.cpan.org index the distro.  Instead, use the use-
23       devel-assertos script.
24

FUNCTIONS

26       Devel::CheckOS implements the following functions, which load
27       subsidiary OS-specific modules on demand to do the real work.  They can
28       be exported by listing their names after "use Devel::CheckOS".  You can
29       also export groups of functions thus:
30
31           use Devel::CheckOS qw(:booleans); # export the boolean functions
32                                             # and 'die_unsupported'
33
34           use Devel::CheckOS qw(:fatal);    # export those that die on no match
35
36           use Devel::CheckOS qw(:all);      # export everything
37
38   Boolean functions
39       os_is
40
41       Takes a list of OS names.  If the current platform matches any of them,
42       it returns true, otherwise it returns false.  The names can be a
43       mixture of OSes and OS families, eg ...
44
45           os_is(qw(Unix VMS)); # Unix is a family, VMS is an OS
46
47       os_isnt
48
49       If the current platform matches any of the parameters it returns false,
50       otherwise it returns true.
51
52   Fatal functions
53       die_if_os_isnt
54
55       As "os_is()", except that it dies instead of returning false.  The
56       die() message matches what the CPAN-testers look for to determine if a
57       module doesn't support a particular platform.
58
59       die_if_os_is
60
61       As "os_isnt()", except that it dies instead of returning false.
62
63   And some utility functions ...
64       die_unsupported
65
66       This function simply dies with the message "OS unsupported", which is
67       what the CPAN testers look for to figure out whether a platform is
68       supported or not.
69
70       list_platforms
71
72       When called in list context, return a list of all the platforms for
73       which the corresponding Devel::AssertOS::* module is available.  This
74       includes both OSes and OS families, and both those bundled with this
75       module and any third-party add-ons you have installed.
76
77       In scalar context, returns a hashref keyed by platform with the
78       filename of the most recent version of the supporting module that is
79       available to you.  This is to make sure that the use-devel-assertos
80       script Does The Right Thing in the case where you have installed the
81       module in one version of perl, then upgraded perl, and installed it
82       again in the new version.  Sometimes the old version of perl and all
83       its modules will still be hanging around and perl "helpfully" includes
84       the old perl's search path in its own.
85
86       Unfortunately, on some platforms this list may have file case broken.
87       eg, some platforms might return 'freebsd' instead of 'FreeBSD'.  This
88       is because they have case-insensitive filesystems so things should Just
89       Work anyway.
90

PLATFORMS SUPPORTED

92       To see the list of platforms for which information is available, run
93       this:
94
95           perl -MDevel::CheckOS -e 'print join(", ", Devel::CheckOS::list_platforms())'
96
97       Note that capitalisation is important.  These are the names of the
98       underlying Devel::AssertOS::* modules which do the actual platform
99       detection, so they have to be 'legal' filenames and module names, which
100       unfortunately precludes funny characters, so platforms like OS/2 are
101       mis-spelt deliberately.  Sorry.
102
103       Also be aware that not all of them have been properly tested.  I don't
104       have access to most of them and have had to work from information
105       gleaned from perlport and a few other places.  For a complete list of
106       OS families, see Devel::CheckOS::Families.
107
108       If you want to add your own OSes or families, see
109       Devel::AssertOS::Extending and please feel free to upload the results
110       to the CPAN.
111

BUGS and FEEDBACK

113       I welcome feedback about my code, including constructive criticism.
114       Bug reports should be made using <http://rt.cpan.org/> or by email.
115
116       You will need to include in your bug report the exact value of $^O,
117       what the OS is called (eg Windows Vista 64 bit Ultimate Home Edition),
118       and, if relevant, what "OS family" it should be in and who wrote it.
119
120       If you are feeling particularly generous you can encourage me in my
121       open source endeavours by buying me something from my wishlist:
122         <http://www.cantrell.org.uk/david/wishlist/>
123

SEE ALSO

125       $^O in perlvar
126
127       perlport
128
129       Devel::AssertOS
130
131       Devel::AssertOS::Extending
132
133       Probe::Perl
134
135       The use-devel-assertos script
136

AUTHOR

138       David Cantrell <david@cantrell.org.uk>
139
140       Thanks to David Golden for the name and ideas about the interface, and
141       to the cpan-testers-discuss mailing list for prompting me to write it
142       in the first place.
143
144       Thanks to Ken Williams, from whose Module::Build I lifted some of the
145       information about what should be in the Unix family.
146
147       Thanks to Billy Abbott for finding some bugs for me on VMS.
148
149       Thanks to Matt Kraai for information about QNX.
150
151       Thanks to Kenichi Ishigaki and Gabor Szabo for reporting a bug on
152       Windows, and to the former for providing a patch.
153

CVS

155       http://drhyde.cvs.sourceforge.net/drhyde/perlmodules/Devel-CheckOS/
156       <http://drhyde.cvs.sourceforge.net/drhyde/perlmodules/Devel-CheckOS/>
157
159       Copyright 2007 David Cantrell
160
161       This software is free-as-in-speech software, and may be used,
162       distributed, and modified under the terms of either the GNU General
163       Public Licence version 2 or the Artistic Licence. It's up to you which
164       one you use. The full text of the licences can be found in the files
165       GPL2.txt and ARTISTIC.txt, respectively.
166

CONSPIRACY

168       This module is also free-as-in-mason software.
169
170
171
172perl v5.12.0                      2008-11-11                 Devel::CheckOS(3)
Impressum