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
|
24
|
|
|
24
|
|
5170
|
use strict; |
|
24
|
|
|
|
|
26
|
|
|
24
|
|
|
|
|
609
|
|
6
|
24
|
|
|
24
|
|
74
|
use warnings; |
|
24
|
|
|
|
|
22
|
|
|
24
|
|
|
|
|
565
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package POSIX::1003::Module; |
9
|
24
|
|
|
24
|
|
73
|
use vars '$VERSION'; |
|
24
|
|
|
|
|
22
|
|
|
24
|
|
|
|
|
921
|
|
10
|
|
|
|
|
|
|
$VERSION = '0.99_07'; |
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_07'; |
17
|
24
|
|
|
24
|
|
79
|
use Carp 'croak'; |
|
24
|
|
|
|
|
21
|
|
|
24
|
|
|
|
|
1387
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# some other modules used by the program which uses POSIX::1003 may |
20
|
|
|
|
|
|
|
# need POSIX.xs via POSIX. |
21
|
24
|
|
|
24
|
|
8993
|
use POSIX (); |
|
24
|
|
|
|
|
96443
|
|
|
24
|
|
|
|
|
579
|
|
22
|
|
|
|
|
|
|
|
23
|
24
|
|
|
24
|
|
255
|
use XSLoader; |
|
24
|
|
|
|
|
20
|
|
|
24
|
|
|
|
|
1079
|
|
24
|
|
|
|
|
|
|
XSLoader::load 'POSIX::1003', $VERSION; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub import(@) |
28
|
78
|
|
|
78
|
|
833
|
{ my $class = shift; |
29
|
78
|
50
|
|
|
|
182
|
return if $class eq __PACKAGE__; |
30
|
|
|
|
|
|
|
|
31
|
24
|
|
|
24
|
|
83
|
no strict 'refs'; |
|
24
|
|
|
|
|
29
|
|
|
24
|
|
|
|
|
557
|
|
32
|
24
|
|
|
24
|
|
69
|
no warnings 'once'; |
|
24
|
|
|
|
|
26
|
|
|
24
|
|
|
|
|
11439
|
|
33
|
|
|
|
|
|
|
|
34
|
78
|
50
|
|
|
|
64
|
my $tags = \%{"${class}::EXPORT_TAGS"} or die; |
|
78
|
|
|
|
|
292
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# A hash-lookup is faster than an array lookup, so %EXPORT_OK |
37
|
78
|
|
|
|
|
76
|
%{"${class}::EXPORT_OK"} = (); |
|
78
|
|
|
|
|
341
|
|
38
|
78
|
|
|
|
|
66
|
my $ok = \%{"${class}::EXPORT_OK"}; |
|
78
|
|
|
|
|
129
|
|
39
|
78
|
50
|
|
|
|
230
|
unless(keys %$ok) |
40
|
78
|
|
|
|
|
176
|
{ @{$ok}{@{$tags->{$_}}} = () for keys %$tags; |
|
320
|
|
|
|
|
1306
|
|
|
320
|
|
|
|
|
363
|
|
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
78
|
100
|
100
|
|
|
427
|
my $level = @_ && $_[0] =~ m/^\+(\d+)$/ ? shift : 0; |
44
|
78
|
100
|
100
|
|
|
293
|
return if @_==1 && $_[0] eq ':none'; |
45
|
57
|
100
|
|
|
|
108
|
@_ = ':all' if !@_; |
46
|
|
|
|
|
|
|
|
47
|
57
|
|
|
|
|
53
|
my %take; |
48
|
57
|
|
|
|
|
85
|
foreach (@_) |
49
|
98
|
100
|
|
|
|
199
|
{ if( $_ eq ':all') |
|
|
100
|
|
|
|
|
|
50
|
12
|
|
|
|
|
170
|
{ @take{keys %$ok} = (); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
elsif( m/^:(.*)/ ) |
53
|
3
|
50
|
|
|
|
11
|
{ my $tag = $tags->{$1} or croak "$class does not export $_"; |
54
|
3
|
|
|
|
|
26
|
@take{@$tag} = (); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
else |
57
|
83
|
50
|
33
|
|
|
1988
|
{ is_missing($_) or exists $ok->{$_} |
58
|
|
|
|
|
|
|
or croak "$class does not export $_"; |
59
|
83
|
|
|
|
|
143
|
undef $take{$_}; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
57
|
|
50
|
|
|
64
|
my $in_core = \@{$class.'::IN_CORE'} || []; |
64
|
|
|
|
|
|
|
|
65
|
57
|
|
|
|
|
278
|
my $pkg = (caller $level)[0]; |
66
|
57
|
|
|
|
|
393
|
foreach my $f (sort keys %take) |
67
|
761
|
|
|
|
|
478
|
{ my $export; |
68
|
761
|
100
|
100
|
|
|
404
|
if(exists ${$class.'::'}{$f} && ($export = *{"${class}::$f"}{CODE})) |
|
761
|
100
|
66
|
|
|
4559
|
|
|
192
|
50
|
33
|
|
|
633
|
|
|
|
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
|
510
|
|
|
|
|
748
|
{ *{$class.'::'.$f} = $export = $class->_create_constant($f); |
|
510
|
|
|
|
|
1295
|
|
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
|
|
|
|
|
|
|
#warn "$f from POSIX.pm"; |
80
|
0
|
0
|
0
|
|
|
0
|
if(exists $POSIX::{$f} && defined *{"POSIX::$f"}{CODE}) |
|
0
|
|
|
|
|
0
|
|
81
|
|
|
|
|
|
|
{ # POSIX.xs croaks on undefined constants, we will return undef |
82
|
0
|
|
|
|
|
0
|
my $const = eval "POSIX::$f()"; |
83
|
0
|
|
|
0
|
|
0
|
*{$class.'::'.$f} = $export |
|
0
|
|
|
|
|
0
|
|
84
|
0
|
0
|
|
0
|
|
0
|
= defined $const ? sub() {$const} : sub() {undef}; |
|
0
|
|
|
|
|
0
|
|
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
else |
87
|
|
|
|
|
|
|
{ # ignore the missing value |
88
|
|
|
|
|
|
|
# warn "missing constant in POSIX.pm $f" && next; |
89
|
0
|
|
|
0
|
|
0
|
*{$class.'::'.$f} = $export = sub() {undef}; |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
elsif($f =~ s/^%//) |
93
|
21
|
|
|
|
|
69
|
{ $export = \%{"${class}::$f"}; |
|
21
|
|
|
|
|
60
|
|
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
elsif($in_core && grep $f eq $_, @$in_core) |
96
|
29
|
|
|
|
|
89
|
{ # function is in core, simply ignore the export |
97
|
35
|
|
|
|
|
2152
|
next; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
elsif(exists $POSIX::{$f} && defined *{"POSIX::$f"}{CODE}) |
100
|
|
|
|
|
|
|
{ # normal functions implemented in POSIX.xs |
101
|
29
|
|
|
|
|
25
|
*{"${class}::$f"} = $export = *{"POSIX::$f"}{CODE}; |
|
29
|
|
|
|
|
69
|
|
|
29
|
|
|
|
|
36
|
|
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
else |
104
|
0
|
|
|
|
|
0
|
{ croak "unable to load $f from $class"; |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
24
|
|
|
24
|
|
101
|
no warnings 'once'; |
|
24
|
|
|
|
|
33
|
|
|
24
|
|
|
|
|
2614
|
|
108
|
726
|
|
|
|
|
506
|
*{"${pkg}::$f"} = $export; |
|
726
|
|
|
|
|
24786
|
|
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
sub exampleValue($) |
114
|
0
|
|
|
0
|
1
|
0
|
{ my ($pkg, $name) = @_; |
115
|
24
|
|
|
24
|
|
94
|
no strict 'refs'; |
|
24
|
|
|
|
|
25
|
|
|
24
|
|
|
|
|
2337
|
|
116
|
|
|
|
|
|
|
|
117
|
0
|
0
|
|
|
|
0
|
my $tags = \%{"$pkg\::EXPORT_TAGS"} or die; |
|
0
|
|
|
|
|
0
|
|
118
|
0
|
|
0
|
|
|
0
|
my $constants = $tags->{constants} || []; |
119
|
0
|
0
|
|
|
|
0
|
grep $_ eq $name, @$constants |
120
|
|
|
|
|
|
|
or return undef; |
121
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
0
|
my $val = $pkg->_create_constant($name)->(); |
123
|
0
|
0
|
|
|
|
0
|
defined $val ? $val : 'undef'; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
package POSIX::1003::ReadOnlyTable; |
127
|
24
|
|
|
24
|
|
88
|
use vars '$VERSION'; |
|
24
|
|
|
|
|
22
|
|
|
24
|
|
|
|
|
3161
|
|
128
|
|
|
|
|
|
|
$VERSION = '0.99_07'; |
129
|
|
|
|
|
|
|
|
130
|
82
|
|
|
82
|
|
12711
|
sub TIEHASH($) { bless $_[1], $_[0] } |
131
|
633
|
|
|
633
|
|
5642
|
sub FETCH($) { $_[0]->{$_[1]} } |
132
|
0
|
|
|
0
|
|
0
|
sub EXISTS($) { exists $_[0]->{$_[1]} } |
133
|
8
|
|
|
8
|
|
337
|
sub FIRSTKEY() { scalar %{$_[0]}; scalar each %{$_[0]} } |
|
8
|
|
|
|
|
31
|
|
|
8
|
|
|
|
|
9
|
|
|
8
|
|
|
|
|
63
|
|
134
|
60
|
|
|
60
|
|
34
|
sub NEXTKEY() { scalar each %{$_[0]} } |
|
60
|
|
|
|
|
106
|
|
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
1; |