line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl::osnames; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
4
|
|
|
|
|
|
|
our $DATE = '2020-02-10'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'Perl-osnames'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.120'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
449
|
use strict; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
30
|
|
9
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use Exporter qw(import); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
563
|
|
12
|
|
|
|
|
|
|
our @EXPORT_OK = qw($data is_unix is_posix |
13
|
|
|
|
|
|
|
$RE_OS_IS_KNOWN $RE_OS_IS_POSIX $RE_OS_IS_UNIX); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $data = [map { |
16
|
|
|
|
|
|
|
chomp; |
17
|
|
|
|
|
|
|
my @f = split /\s+/, $_, 3; |
18
|
|
|
|
|
|
|
$f[1] = $f[1] eq '-' ? [] : [split /,/, $f[1]]; |
19
|
|
|
|
|
|
|
\@f; |
20
|
|
|
|
|
|
|
} split /^/m, <<'_']; |
21
|
|
|
|
|
|
|
aix posix,sysv,unix IBM AIX. |
22
|
|
|
|
|
|
|
amigaos - |
23
|
|
|
|
|
|
|
android sysv,unix |
24
|
|
|
|
|
|
|
bsdos bsd,unix BSD/OS. Originally called BSD/386, also known as BSDi. |
25
|
|
|
|
|
|
|
beos posix See also: haiku. |
26
|
|
|
|
|
|
|
bitrig bsd,unix An OpenBSD fork. |
27
|
|
|
|
|
|
|
dgux sysv,unix DG/UX. |
28
|
|
|
|
|
|
|
dos - |
29
|
|
|
|
|
|
|
dynixptx sysv,unix DYNIX/ptx. |
30
|
|
|
|
|
|
|
cygwin posix,unix Unix-like emulation layer that runs on Windows. |
31
|
|
|
|
|
|
|
darwin bsd,posix,unix Mac OS X. Does not currently (2013) include iOS. See also: iphoneos. |
32
|
|
|
|
|
|
|
dec_osf - DEC Alpha. |
33
|
|
|
|
|
|
|
dragonfly bsd,posix,unix DragonFly BSD. |
34
|
|
|
|
|
|
|
freebsd bsd,posix,unix |
35
|
|
|
|
|
|
|
gnukfreebsd bsd,posix,unix Debian GNU/kFreeBSD. |
36
|
|
|
|
|
|
|
haiku posix See also: beos. |
37
|
|
|
|
|
|
|
hpux posix,sysv,unix HP-UX. |
38
|
|
|
|
|
|
|
interix posix,unix Optional, POSIX-compliant Unix subsystem for Windows NT. Also known as Microsoft SFU. No longer included in Windows nor supported. |
39
|
|
|
|
|
|
|
irix posix,sysv,unix |
40
|
|
|
|
|
|
|
linux posix,sysv,unix |
41
|
|
|
|
|
|
|
MacOS - Mac OS Classic (predates Mac OS X). See also: darwin, iphoneos. |
42
|
|
|
|
|
|
|
machten bsd,unix MachTen, an operating system that runs virtually under Mac OS. |
43
|
|
|
|
|
|
|
midnightbsd bsd,posix,unix |
44
|
|
|
|
|
|
|
minix bsd,posix |
45
|
|
|
|
|
|
|
mirbsd bsd,posix,unix MirOS BSD. |
46
|
|
|
|
|
|
|
mpeix - MPEiX. |
47
|
|
|
|
|
|
|
MSWin32 - All Windows platforms including 95/98/ME/NT/2000/XP/CE/.NET. But does not include Cygwin (see "cygwin") or Interix (see "interix"). To get more details on which Windows you are on, use Win32::GetOSName() or Win32::GetOSVersion(). Ref: perlvar. |
48
|
|
|
|
|
|
|
netbsd bsd,posix,unix |
49
|
|
|
|
|
|
|
next unix NeXTSTEP OS. |
50
|
|
|
|
|
|
|
nto unix ? |
51
|
|
|
|
|
|
|
openbsd bsd,posix,unix |
52
|
|
|
|
|
|
|
os390 ebcdic |
53
|
|
|
|
|
|
|
os400 ebcdic |
54
|
|
|
|
|
|
|
posix-bc ebcdic |
55
|
|
|
|
|
|
|
qnx unix |
56
|
|
|
|
|
|
|
riscos - |
57
|
|
|
|
|
|
|
sco posix,sysv,unix SCO UNIX. |
58
|
|
|
|
|
|
|
solaris posix,sysv,unix This includes the old SunOS. |
59
|
|
|
|
|
|
|
vmesa ebcdic |
60
|
|
|
|
|
|
|
vms - |
61
|
|
|
|
|
|
|
vos - |
62
|
|
|
|
|
|
|
_ |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# dump: display data as table |
65
|
|
|
|
|
|
|
#use Data::Format::Pretty::Text qw(format_pretty); |
66
|
|
|
|
|
|
|
#say format_pretty($data, { |
67
|
|
|
|
|
|
|
# table_column_formats=>[{description=>[[wrap=>{columns=>40}]]}], |
68
|
|
|
|
|
|
|
# table_column_orders=>[[qw/code summary description/]], |
69
|
|
|
|
|
|
|
#}); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# debug: dump data |
72
|
|
|
|
|
|
|
#use Data::Dump::Color; |
73
|
|
|
|
|
|
|
#dd $data; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
our $RE_OS_IS_KNOWN = do { |
76
|
|
|
|
|
|
|
my $re = join "|", map { $_->[0] } @$data; |
77
|
|
|
|
|
|
|
qr/\A(?:$re)\z/; |
78
|
|
|
|
|
|
|
}; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
our $RE_OS_IS_POSIX = do { |
81
|
|
|
|
|
|
|
my @os; |
82
|
|
|
|
|
|
|
OS: |
83
|
|
|
|
|
|
|
for my $rec (@$data) { |
84
|
|
|
|
|
|
|
for (@{$rec->[1]}) { |
85
|
|
|
|
|
|
|
do { push @os, $rec->[0]; next OS } if $_ eq 'posix'; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
my $re = join("|", @os); |
89
|
|
|
|
|
|
|
qr/\A(?:$re)\z/; |
90
|
|
|
|
|
|
|
}; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
our $RE_OS_IS_UNIX = do { |
93
|
|
|
|
|
|
|
my @os; |
94
|
|
|
|
|
|
|
OS: |
95
|
|
|
|
|
|
|
for my $rec (@$data) { |
96
|
|
|
|
|
|
|
for (@{$rec->[1]}) { |
97
|
|
|
|
|
|
|
do { push @os, $rec->[0]; next OS } if $_ eq 'unix'; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
my $re = join("|", @os); |
101
|
|
|
|
|
|
|
qr/\A(?:$re)\z/; |
102
|
|
|
|
|
|
|
}; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub is_posix { |
105
|
3
|
|
33
|
3
|
1
|
1158
|
my $os = shift || $^O; |
106
|
3
|
100
|
|
|
|
32
|
return undef unless $os =~ $RE_OS_IS_KNOWN; |
107
|
2
|
100
|
|
|
|
18
|
$os =~ $RE_OS_IS_POSIX ? 1:0; |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
sub is_unix { |
111
|
3
|
|
33
|
3
|
1
|
2462
|
my $os = shift || $^O; |
112
|
3
|
100
|
|
|
|
25
|
return undef unless $os =~ $RE_OS_IS_KNOWN; |
113
|
2
|
100
|
|
|
|
16
|
$os =~ $RE_OS_IS_UNIX ? 1:0; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
1; |
117
|
|
|
|
|
|
|
# ABSTRACT: List possible $^O ($OSNAME) values, with description |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
__END__ |