Perlito5X/Perl/OSType.pm untested

filter: Statementstmt 0.0% 0 / 24 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 40 CC 4 SCAR 19.1
CC
4
Cov
0%
is_os_type
12.0
os_type
6.0
BEGIN
2.0
CRAP 6.8
1 use strict;
2 use warnings;
3  
4 package Perl::OSType;
5 # ABSTRACT: Map Perl operating system names to generic types
6  
7 our $VERSION = '1.010';
8  
9 require Exporter;
10 our @ISA = qw(Exporter);
11  
12 our %EXPORT_TAGS = ( all => [qw( os_type is_os_type )] );
13  
14 our @EXPORT_OK = @{ $EXPORT_TAGS{all} };
15  
16 # originally taken from Module::Build by Ken Williams et al.
17 my %OSTYPES = qw(
18 aix Unix
19 bsdos Unix
20 beos Unix
21 bitrig Unix
22 dgux Unix
23 dragonfly Unix
24 dynixptx Unix
25 freebsd Unix
26 linux Unix
27 haiku Unix
28 hpux Unix
29 iphoneos Unix
30 irix Unix
31 darwin Unix
32 machten Unix
33 midnightbsd Unix
34 minix Unix
35 mirbsd Unix
36 next Unix
37 openbsd Unix
38 netbsd Unix
39 dec_osf Unix
40 nto Unix
41 svr4 Unix
42 svr5 Unix
43 sco Unix
44 sco_sv Unix
45 unicos Unix
46 unicosmk Unix
47 solaris Unix
48 sunos Unix
49 cygwin Unix
50 msys Unix
51 os2 Unix
52 interix Unix
53 gnu Unix
54 gnukfreebsd Unix
55 nto Unix
56 qnx Unix
57 android Unix
58  
59 dos Windows
60 MSWin32 Windows
61  
62 os390 EBCDIC
63 os400 EBCDIC
64 posix-bc EBCDIC
65 vmesa EBCDIC
66  
67 MacOS MacOS
68 VMS VMS
69 vos VOS
70 riscos RiscOS
71 amigaos Amiga
72 mpeix MPEiX
73 );
74  
75 sub os_type {
76 my ($os) = @_;
77 $os = $^O unless defined $os;
78 return $OSTYPES{$os} || q{};
79 }
80  
81 sub is_os_type {
82 my ( $type, $os ) = @_;
83 return unless $type;
84 $os = $^O unless defined $os;
85 return os_type($os) eq $type;
86 }
87  
88 1;
89  
90 =pod
91  
92 =encoding UTF-8
93  
94 =head1 NAME
95  
96 Perl::OSType - Map Perl operating system names to generic types
97  
98 =head1 VERSION
99  
100 version 1.010
101  
102 =head1 SYNOPSIS
103  
104 use Perl::OSType ':all';
105  
106 $current_type = os_type();
107 $other_type = os_type('dragonfly'); # gives 'Unix'
108  
109 =head1 DESCRIPTION
110  
111 Modules that provide OS-specific behaviors often need to know if
112 the current operating system matches a more generic type of
113 operating systems. For example, 'linux' is a type of 'Unix' operating system
114 and so is 'freebsd'.
115  
116 This module provides a mapping between an operating system name as given by
117 C<$^O> and a more generic type. The initial version is based on the OS type
118 mappings provided in L<Module::Build> and L<ExtUtils::CBuilder>. (Thus,
119 Microsoft operating systems are given the type 'Windows' rather than 'Win32'.)
120  
121 =head1 USAGE
122  
123 No functions are exported by default. The export tag ":all" will export
124 all functions listed below.
125  
126 =head2 os_type()
127  
128 $os_type = os_type();
129 $os_type = os_type('MSWin32');
130  
131 Returns a single, generic OS type for a given operating system name. With no
132 arguments, returns the OS type for the current value of C<$^O>. If the
133 operating system is not recognized, the function will return the empty string.
134  
135 =head2 is_os_type()
136  
137 $is_windows = is_os_type('Windows');
138 $is_unix = is_os_type('Unix', 'dragonfly');
139  
140 Given an OS type and OS name, returns true or false if the OS name is of the
141 given type. As with C<os_type>, it will use the current operating system as a
142 default if no OS name is provided.
143  
144 =head1 SEE ALSO
145  
146 =over 4
147  
148 =item *
149  
150 L<Devel::CheckOS>
151  
152 =back
153  
154 =for :stopwords cpan testmatrix url annocpan anno bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
155  
156 =head1 SUPPORT
157  
158 =head2 Bugs / Feature Requests
159  
160 Please report any bugs or feature requests through the issue tracker
161 at L<https://github.com/Perl-Toolchain-Gang/Perl-OSType/issues>.
162 You will be notified automatically of any progress on your issue.
163  
164 =head2 Source Code
165  
166 This is open source software. The code repository is available for
167 public review and contribution under the terms of the license.
168  
169 L<https://github.com/Perl-Toolchain-Gang/Perl-OSType>
170  
171 git clone https://github.com/Perl-Toolchain-Gang/Perl-OSType.git
172  
173 =head1 AUTHOR
174  
175 David Golden <dagolden@cpan.org>
176  
177 =head1 CONTRIBUTORS
178  
179 =for stopwords Chris 'BinGOs' Williams David Golden Graham Ollis Jonas B. Nielsen Owain G. Ainsworth Paul Green Piotr Roszatycki
180  
181 =over 4
182  
183 =item *
184  
185 Chris 'BinGOs' Williams <chris@bingosnet.co.uk>
186  
187 =item *
188  
189 David Golden <xdg@xdg.me>
190  
191 =item *
192  
193 Graham Ollis <plicease@cpan.org>
194  
195 =item *
196  
197 Jonas B. Nielsen <jonasbn@hoarfrost.local>
198  
199 =item *
200  
201 Owain G. Ainsworth <oga@nicotinebsd.org>
202  
203 =item *
204  
205 Paul Green <Paul.Green@stratus.com>
206  
207 =item *
208  
209 Piotr Roszatycki <piotr.roszatycki@gmail.com>
210  
211 =back
212  
213 =head1 COPYRIGHT AND LICENSE
214  
215 This software is copyright (c) 2016 by David Golden.
216  
217 This is free software; you can redistribute it and/or modify it under
218 the same terms as the Perl 5 programming language system itself.
219  
220 =cut
221  
222 __END__