File Coverage

blib/lib/Devel/CheckOS.pm
Criterion Covered Total %
statement 447 657 68.0
branch 28 30 93.3
condition 6 11 54.5
subroutine 219 219 100.0
pod 8 8 100.0
total 708 925 76.5


line stmt bran cond sub pod time code
1             package Devel::CheckOS;
2              
3 51     51   850928 use strict;
  31         174  
  31         879  
4 51     51   10043 use warnings;
  33         78  
  33         841  
5              
6 50     50   9422 use Exporter;
  33         87  
  33         1321  
7             # if we're loading this from Makefile.PL, FFR might not yet be installed
8 39     39   17937 eval 'use File::Find::Rule';
  28         215383  
  28         246  
9 51     51   7049 use File::Spec;
  35         170  
  35         1176  
10              
11 40     40   4926 use vars qw(@ISA @EXPORT_OK %EXPORT_TAGS %OS_ALIASES);
  31         292  
  31         15648  
12              
13             our $VERSION = '1.96';
14              
15             @ISA = qw(Exporter);
16             @EXPORT_OK = qw(
17             os_is os_isnt die_if_os_is die_if_os_isnt die_unsupported
18             list_platforms list_family_members register_alias
19             );
20             %EXPORT_TAGS = (
21             all => \@EXPORT_OK,
22             booleans => [qw(os_is os_isnt die_unsupported)],
23             fatal => [qw(die_if_os_is die_if_os_isnt)]
24             );
25              
26             # get a list of the .pm files under a list of dirs, or the empty list
27             # in taint mode
28             sub _find_pm_files_in_dirs {
29 651     651   5487 my @files;
30 645         1424 eval { @files = File::Find::Rule->file()->name('*.pm')->in(@_) };
  645         23242  
31 650         9469305 return @files;
32             }
33              
34             if(exists($INC{'File/Find/Rule.pm'})) {
35             foreach my $alias_module (
36             _find_pm_files_in_dirs(
37             grep { -d }
38             map { File::Spec->catdir($_, qw(Devel AssertOS Alias)) }
39             @INC
40             )
41             ) {
42             my(undef, undef, $file_part) = File::Spec->splitpath($alias_module);
43             $file_part =~ s/\.pm$//;
44 38     38   15030 eval "use Devel::AssertOS::Alias::$file_part";
  31     38   108  
  31     29   654  
  38         2617  
  28         64  
  28         347  
  29         3510  
  20         42  
  20         251  
45             warn("Bad alias module 'Devel::AssertOS::Alias::$file_part' ignored\n") if($@);
46             }
47             }
48              
49             =head1 NAME
50              
51             Devel::CheckOS - check what OS we're running on
52              
53             =head1 DESCRIPTION
54              
55             A learned sage once wrote on IRC:
56              
57             $^O is stupid and ugly, it wears its pants as a hat
58              
59             Devel::CheckOS provides a more friendly interface to $^O, and also lets
60             you check for various OS "families" such as "Unix", which includes things
61             like Linux, Solaris, AIX etc.
62              
63             It spares perl the embarrassment of wearing its pants on its head by
64             covering them with a splendid Fedora.
65              
66             =head1 SYNOPSIS
67              
68             use Devel::CheckOS qw(os_is);
69             print "Hey, I know this, it's a Unix system\n" if(os_is('Unix'));
70              
71             print "You've got Linux 2.6\n" if(os_is('Linux::v2_6'));
72              
73             =head1 USING IT IN Makefile.PL or Build.PL
74              
75             If you want to use this from Makefile.PL or Build.PL, do
76             not simply copy the module into your distribution as this may cause
77             problems when PAUSE and search.cpan.org index the distro. Instead, use
78             the use-devel-assertos script.
79              
80             =head1 FUNCTIONS
81              
82             Devel::CheckOS implements the following functions, which load subsidiary
83             OS-specific modules on demand to do the real work. They can all be exported
84             by listing their names after C. You can also export
85             groups of functions thus:
86              
87             use Devel::CheckOS qw(:booleans); # export the boolean functions
88             # and 'die_unsupported'
89            
90             use Devel::CheckOS qw(:fatal); # export those that die on no match
91              
92             use Devel::CheckOS qw(:all); # export everything exportable
93              
94             =head2 Boolean functions
95              
96             =head3 os_is
97              
98             Takes a list of OS names. If the current platform matches any of them,
99             it returns true, otherwise it returns false. The names can be a mixture
100             of OSes and OS families, eg ...
101              
102             os_is(qw(Unix VMS)); # Unix is a family, VMS is an OS
103              
104             Matching is case-insensitive provided that Taint-mode is not enabled, so the
105             above could also be written:
106              
107             os_is(qw(unix vms));
108              
109             =cut
110              
111             sub os_is {
112 292     303 1 32363 my @targets = @_;
113 292         724 my $rval = 0;
114              
115 303         3544 TARGET: foreach my $target (@targets) {
116             # resolve aliases
117 604         2743 ALIAS: foreach my $alias (keys %OS_ALIASES) {
118 604 100       4576 if($target =~ /^$alias$/i) {
119 15         3467 $target = $OS_ALIASES{$alias};
120 3         7 last ALIAS;
121             }
122             }
123              
124             # resolve case-insensitive names (no-op in taint-mode as list_platforms
125             # won't work)
126 601         2078 my @available_platforms = list_platforms();
127 611         5681 CANDIDATE: foreach my $candidate (@available_platforms) {
128 22098 100       156710 if($target =~ /^\Q$candidate\E$/i) {
129 601         1581 $target = $candidate;
130 610         5074 last CANDIDATE;
131             }
132             }
133              
134 601 100       5502 die("Devel::CheckOS: $target isn't a legal OS name\n")
135             unless($target =~ /^\w+(::\w+)*$/);
136 35     35   16350 eval "use Devel::AssertOS::$target";
  13     30   1582  
  13     26   367  
  30     13   10222  
  9     12   212  
  9     11   221  
  26     11   8875  
  7     10   168  
  7     10   174  
  600     10   75403  
  8     8   2475  
  13     8   1780  
  4     9   65  
  6     10   108  
  15     11   1372  
  10     11   200  
  9     11   1614  
  6     4   1127  
  3     3   47  
  4     8   64  
  6     3   612  
  5     3   95  
  5     7   919  
  8     2   1258  
  3     1   9  
  6     6   85  
  6     1   34  
  6     1   86  
  6     6   524  
  3     1   1333  
  0     1   0  
  0     6   0  
  7     1   728  
  2     1   5  
  2     6   42  
  2     1   464  
  1     1   5  
  1     4   40  
  1     1   519  
  0     1   0  
  0     4   0  
  6     1   150  
  1     1   3  
  1     1   18  
  1     1   6  
  1     1   3  
  1     1   48  
  1     1   592  
  0     1   0  
  0     1   0  
  6     1   601  
  1     1   3  
  1     1   18  
  1     1   6  
  1     1   2  
  1     1   37  
  1     1   523  
  0     1   0  
  0     1   0  
  6     1   579  
  3     1   6  
  3     1   94  
  1     1   6  
  1     1   3  
  1     1   42  
  1         575  
  0         0  
  0         0  
  6         658  
  1         2  
  1         19  
  1         7  
  1         2  
  1         47  
  1         563  
  0         0  
  0         0  
  4         113  
  0         0  
  0         0  
  1         6  
  1         5  
  1         49  
  1         550  
  0         0  
  0         0  
  4         83  
  1         3  
  1         18  
  1         7  
  1         6  
  1         48  
  1         560  
  0         0  
  0         0  
  4         85  
  1         3  
  1         29  
  1         6  
  1         3  
  1         39  
  1         631  
  0         0  
  0         0  
  4         88  
  1         3  
  1         21  
  1         8  
  1         2  
  1         36  
  1         538  
  0         0  
  0         0  
  4         84  
  1         4  
  1         20  
  1         7  
  1         3  
  1         49  
  1         590  
  0         0  
  0         0  
  4         187  
  1         7  
  1         20  
  1         8  
  1         2  
  1         48  
  1         561  
  0         0  
  0         0  
  1         12  
  1         2  
  0         0  
  1         28  
  0         0  
  0         0  
  1         35  
  0         0  
  0         0  
  1         25  
  0         0  
  0         0  
  1         32  
  0         0  
  0         0  
  1         34  
  0         0  
  0         0  
  1         489  
  0         0  
  1         34  
  1         430  
  0         0  
  0         0  
  1         7  
  1         7  
  1         25  
  1         20  
  0         0  
  0         0  
  1         17  
  1         3  
  1         25  
  1         413  
  0         0  
  0         0  
  1         23  
  0         0  
  0         0  
  1         7  
  1         2  
  1         40  
  1         19  
  0         0  
  0         0  
  1         5  
  1         2  
  1         26  
  1         17  
  0         0  
137 608 100       10856 if(!$@) {
138 40     40   3565 no strict 'refs';
  33         102  
  33         23089  
139 137 100       324 $rval = 1 if(&{"Devel::AssertOS::${target}::os_is"}());
  137         1267  
140             }
141             }
142 298         70522 return $rval;
143             }
144              
145             =head3 os_isnt
146              
147             If the current platform matches (case-insensitively) any of the parameters it
148             returns false, otherwise it returns true.
149              
150             =cut
151              
152             sub os_isnt {
153 31     41 1 134 my @targets = @_;
154 31         148 my $rval = 1;
155 37         2669 foreach my $target (@targets) {
156 61 100       158 $rval = 0 if(os_is($target));
157             }
158 30         653 return $rval;
159             }
160              
161             =head2 Fatal functions
162              
163             =head3 die_if_os_isnt
164              
165             As C, except that it dies instead of returning false. The die()
166             message matches what the CPAN-testers look for to determine if a module
167             doesn't support a particular platform.
168              
169             =cut
170              
171             sub die_if_os_isnt {
172 18 100   22 1 3240 os_is(@_) ? 1 : die_unsupported();
173             }
174              
175             =head3 die_if_os_is
176              
177             As C, except that it dies instead of returning false.
178              
179             =cut
180              
181             sub die_if_os_is {
182 14 100   21 1 2569 os_isnt(@_) ? 1 : die_unsupported();
183             }
184              
185             =head2 And some utility functions ...
186              
187             =head3 die_unsupported
188              
189             This function simply dies with the message "OS unsupported", which is what
190             the CPAN testers look for to figure out whether a platform is supported or
191             not.
192              
193             =cut
194              
195 303     310 1 12737 sub die_unsupported { die("OS unsupported\n"); }
196              
197             =head3 list_platforms
198              
199             When called in list context,
200             return a list of all the platforms for which the corresponding
201             Devel::AssertOS::* module is available. This includes both OSes and OS
202             families, and both those bundled with this module and any third-party
203             add-ons you have installed.
204              
205             In scalar context, returns a hashref keyed by platform with the filename
206             of the most recent version of the supporting module that is available to you.
207             This behaviour is deprecated.
208              
209             Unfortunately, on some platforms this list may have file case
210             broken. eg, some platforms might return 'freebsd' instead of 'FreeBSD'.
211             This is because they have case-insensitive filesystems so things
212             should Just Work anyway.
213              
214             This function does not work in taint-mode.
215              
216             =cut
217              
218             my $case_flag = File::Spec->case_tolerant ? '(?i)' : '';
219             my $re_Devel = qr/$case_flag ^Devel$/x;
220             my $re_AssertOS = qr/$case_flag ^AssertOS$/x;
221             my $re_Alias = qr/$case_flag ^Alias\b/x;
222              
223             sub list_platforms {
224             # sort by mtime, so oldest last. This was necessary so that if a module
225             # appears twice in @INC we pick the newer one but that functionality is
226             # no longer needed. We do need to de-dupe the list though
227             my @modules = sort {
228 666861         13455345 (stat($a->{file}))[9] <=> (stat($b->{file}))[9]
229             } grep {
230 146104         332756 $_->{module} !~ $re_Alias
231             } map {
232 146109         978316 my (undef, $dir_part, $file_part) = File::Spec->splitpath($_);
233 146103         469410 $file_part =~ s/\.pm$//;
234 146103         553773 my (@dirs) = grep {+length} File::Spec->splitdir($dir_part);
  1511901         2093112  
235 146102         370421 foreach my $i (reverse 1..$#dirs) {
236             next unless(
237 200360 100 66     1123764 $dirs[$i] =~ $re_AssertOS &&
238             $dirs[$i - 1] =~ $re_Devel
239             );;
240 146108         310203 splice @dirs, 0, $i + 1;
241 146103         199534 last;
242             }
243             {
244 146103         703893 module => join('::', @dirs, $file_part),
245             file => File::Spec->canonpath($_)
246             }
247             } _find_pm_files_in_dirs(
248 6501         74569 grep { -d }
249 619     620 1 2148950 map { File::Spec->catdir($_, qw(Devel AssertOS)) }
  6495         35343  
250             @INC
251             );
252              
253             my %modules = map {
254 612         25193 $_->{module} => $_->{file}
255 144474         275141 } @modules;
256              
257 613 100       12928 if(wantarray()) {
258 611         69620 return sort keys %modules;
259             } else {
260 10 100       630 warn("Calling list_platforms in scalar context and getting back a reference is deprecated and will go away some time after April 2024. To disable this warning set \$Devel::CheckOS::NoDeprecationWarnings::Context to a true value.\n") unless($Devel::CheckOS::NoDeprecationWarnings::Context);
261 5         127 return \%modules;
262             }
263             }
264              
265             =head3 list_family_members
266              
267             Takes the name of an OS 'family' and returns a list of all its members.
268             In list context, you get a list, in scalar context you get an arrayref.
269              
270             If called on something that isn't a family, you get an empty list (or
271             a ref to an empty array).
272              
273             =cut
274              
275             sub list_family_members {
276 103   100 109 1 6814747 my $family = shift() ||
277             die(__PACKAGE__."::list_family_members needs a parameter\n");
278              
279             # this will die if it's the wrong OS, but the module is loaded ...
280 107     4   6912 eval qq{use Devel::AssertOS::$family};
  0     1   0  
  4     1   91  
  1     4   3  
  1     1   49  
  1     1   581  
  0     4   0  
  1     1   19  
  1     1   7  
  1     1   2  
  0     1   0  
  1     4   8  
  1     4   2  
  0     1   0  
  1     1   5  
  1     1   3  
  0     1   0  
  4     1   83  
  1     1   2  
  1     1   19  
  4     1   92  
  1     1   4  
  1     1   50  
  1     1   514  
  0     4   0  
  1     4   25  
  1     4   370  
  0     4   0  
  1     1   23  
  1     1   371  
  0     1   0  
  1     1   24  
  1     1   366  
  0     1   0  
  1     1   24  
  1     1   370  
  0     1   0  
  1     1   23  
  1     1   399  
  0     1   0  
  1     1   23  
  1     1   413  
  0     1   0  
  1     1   24  
  1     1   16  
  0     1   0  
  1     1   21  
  1     1   18  
  0     1   0  
  1     1   24  
  1     1   17  
  0     1   0  
  1     1   23  
  1     1   490  
  1     1   8  
  1     1   36  
  4     1   153  
  1     1   3  
  1     1   21  
  4     1   89  
  1     1   5  
  1     1   33  
  4     1   906  
  1     1   6  
  1     1   20  
  4     1   1151  
  1     1   2  
  0     1   0  
  1         64  
  0         0  
  0         0  
  1         28  
  0         0  
  0         0  
  1         31  
  0         0  
  1         29  
  1         33  
  0         0  
  0         0  
  1         30  
  0         0  
  0         0  
  1         28  
  0         0  
  0         0  
  1         665  
  0         0  
  0         0  
  1         621  
  0         0  
  0         0  
  1         614  
  0         0  
  0         0  
  1         611  
  0         0  
  0         0  
  1         610  
  0         0  
  0         0  
  1         596  
  0         0  
  0         0  
  1         30  
  0         0  
  0         0  
  1         27  
  0         0  
  0         0  
  1         29  
  0         0  
  0         0  
  1         44  
  0         0  
  0         0  
  1         28  
  0         0  
  0         0  
  1         27  
  0         0  
  0         0  
  1         28  
  0         0  
  0         0  
  1         28  
  0         0  
  0         0  
  1         23  
  0         0  
  0         0  
  1         31  
  0         0  
  0         0  
  1         24  
  0         0  
  0         0  
  1         25  
  0         0  
  0         0  
  1         26  
  0         0  
  0         0  
  1         7  
  1         1  
  1         25  
  1         28  
  0         0  
  0         0  
  1         5  
  1         13  
  1         20  
  1         29  
  0         0  
  0         0  
  1         7  
  1         3  
  1         26  
  1         505  
  0         0  
  1         38  
  1         19  
  0         0  
  0         0  
  1         6  
  1         4  
  0         0  
  1         26  
  0         0  
  0         0  
  1         7  
  1         3  
  1         25  
  1         17  
  0         0  
  1         23  
  1         15  
  0         0  
  1         22  
  1         6  
  1         3  
  1         21  
  1         16  
  0         0  
  1         23  
  1         15  
  0         0  
  1         23  
  1         15  
  0         0  
  1         20  
  1         14  
  0         0  
  1         20  
281             # ... so we can now query it
282 100     1   5962 my @members = eval qq{
  1     4   19  
  1     1   8  
  1     1   3  
  0     4   0  
  4     1   91  
  1     1   2  
  1     4   51  
  1     1   18  
  0     1   0  
  1     1   24  
  1     4   576  
  0     1   0  
  1     1   25  
  1     1   385  
  0     1   0  
  1     1   18  
  4     1   84  
  1     1   2  
  1     1   27  
  1     1   8  
  1     1   3  
  0     1   0  
  1     4   7  
  1     4   2  
  0     4   0  
  1     4   7  
  1     1   3  
  0     1   0  
  1     1   6  
  1     1   3  
  0     1   0  
  1     1   6  
  1     1   2  
  0     1   0  
  1     1   6  
  1     1   2  
  0     1   0  
  1     1   6  
  1     1   4  
  0     1   0  
  1     1   10  
  1     1   2  
  0     1   0  
  1     1   5  
  1     1   3  
  0     1   0  
  1     1   6  
  1     1   2  
  0     1   0  
  1     1   6  
  1     1   3  
  1     1   34  
  4     1   721  
  1     1   5  
  1     1   23  
  4     1   86  
  1     1   3  
  1     1   21  
  4     1   1217  
  1     1   62  
  1     1   21  
  4     1   972  
  1     1   5  
  1     1   23  
  1     1   28  
  0     1   0  
  0         0  
  1         45  
  0         0  
  0         0  
  1         26  
  0         0  
  0         0  
  1         13  
  1         3  
  0         0  
  1         29  
  0         0  
  0         0  
  1         29  
  0         0  
  0         0  
  1         27  
  0         0  
  0         0  
  1         31  
  0         0  
  0         0  
  1         684  
  0         0  
  0         0  
  1         620  
  0         0  
  0         0  
  1         660  
  0         0  
  0         0  
  1         559  
  0         0  
  0         0  
  1         30  
  0         0  
  0         0  
  1         30  
  0         0  
  0         0  
  1         27  
  0         0  
  0         0  
  1         30  
  0         0  
  0         0  
  1         28  
  0         0  
  0         0  
  1         29  
  0         0  
  0         0  
  1         28  
  0         0  
  1         28  
  1         30  
  0         0  
  0         0  
  1         20  
  0         0  
  0         0  
  1         22  
  0         0  
  0         0  
  1         25  
  0         0  
  0         0  
  1         25  
  0         0  
  0         0  
  1         25  
  0         0  
  0         0  
  1         667  
  0         0  
  0         0  
  1         6  
  1         4  
  1         28  
  1         23  
  0         0  
  0         0  
  1         5  
  1         5  
  1         29  
  1         17  
  0         0  
  0         0  
  1         7  
  1         2  
  0         0  
  1         6  
  1         2  
  1         27  
  1         27  
  0         0  
  1         27  
  1         542  
  0         0  
  0         0  
  1         22  
  0         0  
  0         0  
  1         5  
  1         2  
  0         0  
  1         6  
  1         2  
  0         0  
  1         5  
  1         2  
  1         16  
  1         5  
  1         2  
  0         0  
  1         5  
  1         3  
  0         0  
  1         6  
  1         2  
  0         0  
  1         4  
  1         3  
  0         0  
  1         8  
  1         2  
283             no strict 'refs';
284             &{"Devel::AssertOS::${family}::matches"}()
285             };
286 100 100       479 if(wantarray()) {
287 105         1133 return @members;
288             } else {
289 7 100       47 warn("Calling list_family_members in scalar context and getting back a reference is deprecated and will go away some time after April 2024. To disable this warning set \$Devel::CheckOS::NoDeprecationWarnings::Context to a true value.\n") unless($Devel::CheckOS::NoDeprecationWarnings::Context);
290 7         226 return \@members;
291             }
292             }
293              
294             =head3 register_alias
295              
296             It takes two arguments, the first being an alias name, the second being the
297             name of an OS. After the alias has been registered, any queries about the
298             alias will return the appropriate result for the named OS.
299              
300             It returns true unless you invoke it incorrectly or you attempt to change
301             an existing alias.
302              
303             Aliases don't work under taint-mode.
304              
305             See L.
306              
307             =cut
308              
309             sub register_alias {
310 36     35 1 5126 my($alias, $os) = @_;
311 29 50 33     3670 ($alias && $os) || return 0;
312 29 50 33     225 if(!exists($OS_ALIASES{$alias}) || $OS_ALIASES{$alias} eq $os) {
313 37         1370 return $OS_ALIASES{$alias} = $os;
314             } else {
315 4         34 return 0
316             }
317             }
318              
319             =head1 PLATFORMS SUPPORTED
320              
321             To see the list of platforms for which information is available, run this:
322              
323             perl -MDevel::CheckOS -e 'print join(", ", Devel::CheckOS::list_platforms())'
324              
325             These are the names of the underlying Devel::AssertOS::* modules
326             which do the actual platform detection, so they have to
327             be 'legal' filenames and module names, which unfortunately precludes
328             funny characters, so platforms like OS/2 are mis-spelt deliberately.
329             Sorry.
330              
331             Also be aware that not all of them have been properly tested. I don't
332             have access to most of them and have had to work from information
333             gleaned from L and a few other places. For a complete list of
334             OS families, see L.
335              
336             If you want to add your own OSes or families, see L
337             and please feel free to upload the results to the CPAN.
338              
339             =head1 BUGS and FEEDBACK
340              
341             I welcome feedback about my code, including constructive criticism.
342             Bug reports should be made using L.
343              
344             You will need to include in your bug report the exact value of $^O, what
345             the OS is called (eg Windows Vista 64 bit Ultimate Home Edition), and,
346             if relevant, what "OS family" it should be in and who wrote it.
347              
348             If you are feeling particularly generous you can encourage me in my
349             open source endeavours by buying me something from my wishlist:
350             L
351              
352             =head1 COMPATIBILITY
353              
354             Version 1.90 made all matches case-insensitive. This is a change in behaviour, but
355             if it breaks your code then your code was already broken, you just didn't know it.
356              
357             =head1 DEPRECATIONS
358              
359             At some point after April 2024 the C and C
360             functions will stop being sensitive to whether they are called in list context or
361             not, and will always return a list. From now until then calling them in non-list
362             context will emit a warning. You can turn that off by setting
363             C<$Devel::CheckOS::NoDeprecationWarnings::Context> to a true value.
364              
365             =head1 SEE ALSO
366              
367             $^O in L
368              
369             L
370              
371             L
372              
373             L
374              
375             L
376              
377             The use-devel-assertos script
378              
379             L
380              
381             =head1 AUTHOR
382              
383             David Cantrell EFE
384              
385             Thanks to David Golden for the name and ideas about the interface, and
386             to the cpan-testers-discuss mailing list for prompting me to write it
387             in the first place.
388              
389             Thanks to Ken Williams, from whose L I lifted some of the
390             information about what should be in the Unix family.
391              
392             Thanks to Billy Abbott for finding some bugs for me on VMS.
393              
394             Thanks to Matt Kraai for information about QNX.
395              
396             Thanks to Kenichi Ishigaki and Gabor Szabo for reporting a bug on Windows,
397             and to the former for providing a patch.
398              
399             Thanks to Paul Green for some information about VOS.
400              
401             Thanks to Yanick Champoux for a patch to let Devel::AssertOS support
402             negative assertions.
403              
404             Thanks to Brian Fraser for adding Android support.
405              
406             Thanks to Dale Evans for Debian detection, a bunch of Mac OS X specific version
407             detection modules, and perl 5.6 support.
408              
409             Thanks to Graham Knop for fixing a build bug on perl 5.8.
410              
411             =head1 SOURCE CODE REPOSITORY
412              
413             L
414              
415             =head1 COPYRIGHT and LICENCE
416              
417             Copyright 2023 David Cantrell
418              
419             This software is free-as-in-speech software, and may be used, distributed, and modified under the terms of either the GNU General Public Licence version 2 or the Artistic Licence. It's up to you which one you use. The full text of the licences can be found in the files GPL2.txt and ARTISTIC.txt, respectively.
420              
421             =head1 HATS
422              
423             I recommend buying a Fedora from L.
424              
425             =head1 CONSPIRACY
426              
427             This module is also free-as-in-mason software.
428              
429             =cut
430              
431             1;