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       A learned sage once wrote on IRC:
10
11          $^O is stupid and ugly, it wears its pants as a hat
12
13       Devel::CheckOS provides a more friendly interface to $^O, and also lets
14       you check for various OS "families" such as "Unix", which includes
15       things like Linux, Solaris, AIX etc.
16
17       It spares perl the embarrassment of wearing its pants on its head by
18       covering them with a splendid Fedora.
19

SYNOPSIS

21           use Devel::CheckOS qw(os_is);
22           print "Hey, I know this, it's a Unix system\n" if(os_is('Unix'));
23
24           print "You've got Linux 2.6\n" if(os_is('Linux::v2_6'));
25

USING IT IN Makefile.PL or Build.PL

27       If you want to use this from Makefile.PL or Build.PL, do not simply
28       copy the module into your distribution as this may cause problems when
29       PAUSE and search.cpan.org index the distro.  Instead, use the use-
30       devel-assertos script.
31

FUNCTIONS

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

PLATFORMS SUPPORTED

107       To see the list of platforms for which information is available, run
108       this:
109
110           perl -MDevel::CheckOS -e 'print join(", ", Devel::CheckOS::list_platforms())'
111
112       Note that capitalisation is important.  These are the names of the
113       underlying Devel::AssertOS::* modules which do the actual platform
114       detection, so they have to be 'legal' filenames and module names, which
115       unfortunately precludes funny characters, so platforms like OS/2 are
116       mis-spelt deliberately.  Sorry.
117
118       Also be aware that not all of them have been properly tested.  I don't
119       have access to most of them and have had to work from information
120       gleaned from perlport and a few other places.  For a complete list of
121       OS families, see Devel::CheckOS::Families.
122
123       If you want to add your own OSes or families, see
124       Devel::AssertOS::Extending and please feel free to upload the results
125       to the CPAN.
126

BUGS and FEEDBACK

128       I welcome feedback about my code, including constructive criticism.
129       Bug reports should be made using
130       <https://github.com/DrHyde/perl-modules-Devel-CheckOS/issues>.
131
132       You will need to include in your bug report the exact value of $^O,
133       what the OS is called (eg Windows Vista 64 bit Ultimate Home Edition),
134       and, if relevant, what "OS family" it should be in and who wrote it.
135
136       If you are feeling particularly generous you can encourage me in my
137       open source endeavours by buying me something from my wishlist:
138         <http://www.cantrell.org.uk/david/wishlist/>
139

SEE ALSO

141       $^O in perlvar
142
143       perlport
144
145       Devel::AssertOS
146
147       Devel::AssertOS::Extending
148
149       Probe::Perl
150
151       The use-devel-assertos script
152
153       Module::Install::AssertOS
154

AUTHOR

156       David Cantrell <david@cantrell.org.uk>
157
158       Thanks to David Golden for the name and ideas about the interface, and
159       to the cpan-testers-discuss mailing list for prompting me to write it
160       in the first place.
161
162       Thanks to Ken Williams, from whose Module::Build I lifted some of the
163       information about what should be in the Unix family.
164
165       Thanks to Billy Abbott for finding some bugs for me on VMS.
166
167       Thanks to Matt Kraai for information about QNX.
168
169       Thanks to Kenichi Ishigaki and Gabor Szabo for reporting a bug on
170       Windows, and to the former for providing a patch.
171
172       Thanks to Paul Green for some information about VOS.
173
174       Thanks to Yanick Champoux for a patch to let Devel::AssertOS support
175       negative assertions.
176
177       Thanks to Brian Fraser for adding Android support.
178
179       Thanks to Dale Evans for Debian detection, a bunch of Mac OS X specific
180       version detection modules, and perl 5.6 support.
181
182       Thanks to Graham Knop for fixing a build bug on perl 5.8.
183

SOURCE CODE REPOSITORY

185       <git://github.com/DrHyde/perl-modules-Devel-CheckOS.git>
186
188       Copyright 2007-2020 David Cantrell
189
190       This software is free-as-in-speech software, and may be used,
191       distributed, and modified under the terms of either the GNU General
192       Public Licence version 2 or the Artistic Licence. It's up to you which
193       one you use. The full text of the licences can be found in the files
194       GPL2.txt and ARTISTIC.txt, respectively.
195

HATS

197       I recommend buying a Fedora from <http://hatsdirect.com/>.
198

CONSPIRACY

200       This module is also free-as-in-mason software.
201
202
203
204perl v5.34.0                      2021-07-22                 Devel::CheckOS(3)
Impressum