line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyrights 2011-2015 by [Mark Overmeer]. |
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.01. |
5
|
23
|
|
|
23
|
|
6881
|
use strict; |
|
23
|
|
|
|
|
24
|
|
|
23
|
|
|
|
|
632
|
|
6
|
23
|
|
|
23
|
|
83
|
use warnings; |
|
23
|
|
|
|
|
25
|
|
|
23
|
|
|
|
|
669
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package POSIX::1003::Module; |
9
|
23
|
|
|
23
|
|
95
|
use vars '$VERSION'; |
|
23
|
|
|
|
|
32
|
|
|
23
|
|
|
|
|
1368
|
|
10
|
|
|
|
|
|
|
$VERSION = '0.99_06'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# The VERSION of the distribution is sourced from this file, because |
14
|
|
|
|
|
|
|
# this module also loads the XS extension. Therefore, Makefile.PL |
15
|
|
|
|
|
|
|
# extracts the version from the line below. |
16
|
|
|
|
|
|
|
our $VERSION = '0.99_06'; |
17
|
23
|
|
|
23
|
|
82
|
use Carp 'croak'; |
|
23
|
|
|
|
|
23
|
|
|
23
|
|
|
|
|
1381
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# some other modules used by the program which uses POSIX::1003 may |
20
|
|
|
|
|
|
|
# need POSIX.xs via POSIX. |
21
|
23
|
|
|
23
|
|
9409
|
use POSIX (); |
|
23
|
|
|
|
|
102558
|
|
|
23
|
|
|
|
|
524
|
|
22
|
|
|
|
|
|
|
|
23
|
23
|
|
|
23
|
|
263
|
use XSLoader; |
|
23
|
|
|
|
|
21
|
|
|
23
|
|
|
|
|
1250
|
|
24
|
|
|
|
|
|
|
XSLoader::load 'POSIX::1003', $VERSION; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub import(@) |
28
|
77
|
|
|
77
|
|
1172
|
{ my $class = shift; |
29
|
77
|
50
|
|
|
|
184
|
return if $class eq __PACKAGE__; |
30
|
|
|
|
|
|
|
|
31
|
23
|
|
|
23
|
|
82
|
no strict 'refs'; |
|
23
|
|
|
|
|
22
|
|
|
23
|
|
|
|
|
686
|
|
32
|
23
|
|
|
23
|
|
69
|
no warnings 'once'; |
|
23
|
|
|
|
|
21
|
|
|
23
|
|
|
|
|
13187
|
|
33
|
|
|
|
|
|
|
|
34
|
77
|
50
|
|
|
|
67
|
my $tags = \%{"${class}::EXPORT_TAGS"} or die; |
|
77
|
|
|
|
|
273
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# A hash-lookup is faster than an array lookup, so %EXPORT_OK |
37
|
77
|
|
|
|
|
73
|
%{"${class}::EXPORT_OK"} = (); |
|
77
|
|
|
|
|
336
|
|
38
|
77
|
|
|
|
|
63
|
my $ok = \%{"${class}::EXPORT_OK"}; |
|
77
|
|
|
|
|
131
|
|
39
|
77
|
50
|
|
|
|
185
|
unless(keys %$ok) |
40
|
77
|
|
|
|
|
183
|
{ @{$ok}{@{$tags->{$_}}} = () for keys %$tags; |
|
313
|
|
|
|
|
1277
|
|
|
313
|
|
|
|
|
352
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
77
|
100
|
100
|
|
|
420
|
my $level = @_ && $_[0] =~ m/^\+(\d+)$/ ? shift : 0; |
44
|
77
|
100
|
100
|
|
|
283
|
return if @_==1 && $_[0] eq ':none'; |
45
|
56
|
100
|
|
|
|
108
|
@_ = ':all' if !@_; |
46
|
|
|
|
|
|
|
|
47
|
56
|
|
|
|
|
54
|
my %take; |
48
|
56
|
|
|
|
|
96
|
foreach (@_) |
49
|
96
|
100
|
|
|
|
203
|
{ if( $_ eq ':all') |
|
|
100
|
|
|
|
|
|
50
|
12
|
|
|
|
|
174
|
{ @take{keys %$ok} = (); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
elsif( m/^:(.*)/ ) |
53
|
2
|
50
|
|
|
|
7
|
{ my $tag = $tags->{$1} or croak "$class does not export $_"; |
54
|
2
|
|
|
|
|
15
|
@take{@$tag} = (); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
else |
57
|
82
|
50
|
33
|
|
|
1077
|
{ is_missing($_) or exists $ok->{$_} |
58
|
|
|
|
|
|
|
or croak "$class does not export $_"; |
59
|
82
|
|
|
|
|
152
|
undef $take{$_}; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
56
|
|
50
|
|
|
62
|
my $in_core = \@{$class.'::IN_CORE'} || []; |
64
|
|
|
|
|
|
|
|
65
|
56
|
|
|
|
|
292
|
my $pkg = (caller $level)[0]; |
66
|
56
|
|
|
|
|
417
|
foreach my $f (sort keys %take) |
67
|
732
|
|
|
|
|
531
|
{ my $export; |
68
|
732
|
100
|
100
|
|
|
437
|
if(exists ${$class.'::'}{$f} && ($export = *{"${class}::$f"}{CODE})) |
|
732
|
100
|
66
|
|
|
5437
|
|
|
189
|
50
|
33
|
|
|
775
|
|
|
|
100
|
66
|
|
|
|
|
|
|
100
|
33
|
|
|
|
|
|
|
50
|
|
|
|
|
|
69
|
|
|
|
|
|
|
{ # reuse the already created function; might also be a function |
70
|
|
|
|
|
|
|
# which is actually implemented in the $class namespace. |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
elsif( is_missing($f) |
73
|
|
|
|
|
|
|
|| (exists $ok->{$f} && $f =~ /^[A-Z_][A-Za-z0-9_]*$/)) |
74
|
484
|
|
|
|
|
859
|
{ *{$class.'::'.$f} = $export = $class->_create_constant($f); |
|
484
|
|
|
|
|
1594
|
|
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
elsif( $f !~ m/[^A-Z0-9_]/ ) # faster than: $f =~ m!^[A-Z0-9_]+$! |
77
|
|
|
|
|
|
|
{ # other all-caps names are always from POSIX.xs |
78
|
|
|
|
|
|
|
#XXX MO: there should be any external names left |
79
|
0
|
0
|
0
|
|
|
0
|
if(exists $POSIX::{$f} && defined *{"POSIX::$f"}{CODE}) |
|
0
|
|
|
|
|
0
|
|
80
|
|
|
|
|
|
|
{ # POSIX.xs croaks on undefined constants, we will return undef |
81
|
0
|
|
|
|
|
0
|
my $const = eval "POSIX::$f()"; |
82
|
0
|
|
|
0
|
|
0
|
*{$class.'::'.$f} = $export |
|
0
|
|
|
|
|
0
|
|
83
|
0
|
0
|
|
0
|
|
0
|
= defined $const ? sub() {$const} : sub() {undef}; |
|
0
|
|
|
|
|
0
|
|
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
else |
86
|
|
|
|
|
|
|
{ # ignore the missing value |
87
|
|
|
|
|
|
|
# warn "missing constant in POSIX.pm $f" && next; |
88
|
0
|
|
|
0
|
|
0
|
*{$class.'::'.$f} = $export = sub() {undef}; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
elsif($f =~ s/^%//) |
92
|
21
|
|
|
|
|
60
|
{ $export = \%{"${class}::$f"}; |
|
21
|
|
|
|
|
66
|
|
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
elsif($in_core && grep $f eq $_, @$in_core) |
95
|
29
|
|
|
|
|
106
|
{ # function is in core, simply ignore the export |
96
|
35
|
|
|
|
|
2088
|
next; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
elsif(exists $POSIX::{$f} && defined *{"POSIX::$f"}{CODE}) |
99
|
|
|
|
|
|
|
{ # normal functions implemented in POSIX.xs |
100
|
29
|
|
|
|
|
23
|
*{"${class}::$f"} = $export = *{"POSIX::$f"}{CODE}; |
|
29
|
|
|
|
|
99
|
|
|
29
|
|
|
|
|
45
|
|
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
else |
103
|
0
|
|
|
|
|
0
|
{ croak "unable to load $f from $class"; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
23
|
|
|
23
|
|
109
|
no warnings 'once'; |
|
23
|
|
|
|
|
30
|
|
|
23
|
|
|
|
|
2508
|
|
107
|
697
|
|
|
|
|
588
|
*{"${pkg}::$f"} = $export; |
|
697
|
|
|
|
|
24168
|
|
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub exampleValue($) |
113
|
0
|
|
|
0
|
1
|
0
|
{ my ($pkg, $name) = @_; |
114
|
23
|
|
|
23
|
|
94
|
no strict 'refs'; |
|
23
|
|
|
|
|
23
|
|
|
23
|
|
|
|
|
2502
|
|
115
|
|
|
|
|
|
|
|
116
|
0
|
0
|
|
|
|
0
|
my $tags = \%{"$pkg\::EXPORT_TAGS"} or die; |
|
0
|
|
|
|
|
0
|
|
117
|
0
|
|
0
|
|
|
0
|
my $constants = $tags->{constants} || []; |
118
|
0
|
0
|
|
|
|
0
|
grep $_ eq $name, @$constants |
119
|
|
|
|
|
|
|
or return undef; |
120
|
|
|
|
|
|
|
|
121
|
0
|
|
|
|
|
0
|
my $val = $pkg->_create_constant($name)->(); |
122
|
0
|
0
|
|
|
|
0
|
defined $val ? $val : 'undef'; |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
package POSIX::1003::ReadOnlyTable; |
126
|
23
|
|
|
23
|
|
89
|
use vars '$VERSION'; |
|
23
|
|
|
|
|
23
|
|
|
23
|
|
|
|
|
3914
|
|
127
|
|
|
|
|
|
|
$VERSION = '0.99_06'; |
128
|
|
|
|
|
|
|
|
129
|
79
|
|
|
79
|
|
15402
|
sub TIEHASH($) { bless $_[1], $_[0] } |
130
|
630
|
|
|
630
|
|
14350
|
sub FETCH($) { $_[0]->{$_[1]} } |
131
|
0
|
|
|
0
|
|
0
|
sub EXISTS($) { exists $_[0]->{$_[1]} } |
132
|
8
|
|
|
8
|
|
221
|
sub FIRSTKEY() { scalar %{$_[0]}; scalar each %{$_[0]} } |
|
8
|
|
|
|
|
31
|
|
|
8
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
61
|
|
133
|
60
|
|
|
60
|
|
42
|
sub NEXTKEY() { scalar each %{$_[0]} } |
|
60
|
|
|
|
|
94
|
|
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
1; |