Filename | /usr/share/perl/5.18/Perl/OSType.pm |
Statements | Executed 11 statements in 238µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 8µs | 20µs | BEGIN@1.10 | Path::Class::File::
1 | 1 | 1 | 7µs | 13µs | BEGIN@2 | Path::Class::File::
0 | 0 | 0 | 0s | 0s | is_os_type | Perl::OSType::
0 | 0 | 0 | 0s | 0s | os_type | Perl::OSType::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 2 | 19µs | 2 | 31µs | # spent 20µs (8+11) within Path::Class::File::BEGIN@1.10 which was called:
# once (8µs+11µs) by Path::Class::File::BEGIN@13 at line 1 # spent 20µs making 1 call to Path::Class::File::BEGIN@1.10
# spent 11µs making 1 call to strict::import |
2 | 2 | 186µs | 2 | 19µs | # spent 13µs (7+6) within Path::Class::File::BEGIN@2 which was called:
# once (7µs+6µs) by Path::Class::File::BEGIN@13 at line 2 # spent 13µs making 1 call to Path::Class::File::BEGIN@2
# spent 6µs making 1 call to warnings::import |
3 | package Perl::OSType; | ||||
4 | # ABSTRACT: Map Perl operating system names to generic types | ||||
5 | 1 | 400ns | our $VERSION = '1.003'; # VERSION | ||
6 | |||||
7 | 1 | 500ns | require Exporter; | ||
8 | 1 | 4µs | our @ISA = qw(Exporter); | ||
9 | |||||
10 | 1 | 2µs | our %EXPORT_TAGS = ( | ||
11 | all => [ qw( os_type is_os_type ) ] | ||||
12 | ); | ||||
13 | |||||
14 | 1 | 900ns | our @EXPORT_OK = @{ $EXPORT_TAGS{all} }; | ||
15 | |||||
16 | # originally taken from Module::Build by Ken Williams et al. | ||||
17 | 1 | 16µs | my %OSTYPES = qw( | ||
18 | aix Unix | ||||
19 | bsdos Unix | ||||
20 | beos Unix | ||||
21 | dgux Unix | ||||
22 | dragonfly Unix | ||||
23 | dynixptx Unix | ||||
24 | freebsd Unix | ||||
25 | linux Unix | ||||
26 | haiku Unix | ||||
27 | hpux Unix | ||||
28 | iphoneos Unix | ||||
29 | irix Unix | ||||
30 | darwin Unix | ||||
31 | machten Unix | ||||
32 | midnightbsd Unix | ||||
33 | mirbsd Unix | ||||
34 | next Unix | ||||
35 | openbsd Unix | ||||
36 | netbsd Unix | ||||
37 | dec_osf Unix | ||||
38 | nto Unix | ||||
39 | svr4 Unix | ||||
40 | svr5 Unix | ||||
41 | sco_sv Unix | ||||
42 | unicos Unix | ||||
43 | unicosmk Unix | ||||
44 | solaris Unix | ||||
45 | sunos Unix | ||||
46 | cygwin Unix | ||||
47 | os2 Unix | ||||
48 | interix Unix | ||||
49 | gnu Unix | ||||
50 | gnukfreebsd Unix | ||||
51 | nto Unix | ||||
52 | qnx Unix | ||||
53 | |||||
54 | dos Windows | ||||
55 | MSWin32 Windows | ||||
56 | |||||
57 | os390 EBCDIC | ||||
58 | os400 EBCDIC | ||||
59 | posix-bc EBCDIC | ||||
60 | vmesa EBCDIC | ||||
61 | |||||
62 | MacOS MacOS | ||||
63 | VMS VMS | ||||
64 | vos VOS | ||||
65 | riscos RiscOS | ||||
66 | amigaos Amiga | ||||
67 | mpeix MPEiX | ||||
68 | ); | ||||
69 | |||||
70 | sub os_type { | ||||
71 | my ($os) = @_; | ||||
72 | $os = $^O unless defined $os; | ||||
73 | return $OSTYPES{ $os } || q{}; | ||||
74 | } | ||||
75 | |||||
76 | sub is_os_type { | ||||
77 | my ($type, $os) = @_; | ||||
78 | return unless $type; | ||||
79 | $os = $^O unless defined $os; | ||||
80 | return os_type($os) eq $type; | ||||
81 | } | ||||
82 | |||||
83 | 1 | 9µs | 1; | ||
84 | |||||
85 | __END__ |