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
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
6
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package POSIX::1003::Events; |
9
|
1
|
|
|
1
|
|
3
|
use vars '$VERSION'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
10
|
|
|
|
|
|
|
$VERSION = '0.99_07'; |
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
4
|
use base 'POSIX::1003::Module'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
163
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my (@constants, @poll); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my @functions = qw/ |
17
|
|
|
|
|
|
|
FD_CLR FD_ISSET FD_SET FD_ZERO select |
18
|
|
|
|
|
|
|
poll events_names |
19
|
|
|
|
|
|
|
/; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our %EXPORT_TAGS = |
22
|
|
|
|
|
|
|
( constants => \@constants |
23
|
|
|
|
|
|
|
, poll => \@poll |
24
|
|
|
|
|
|
|
, functions => \@functions |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $events; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
BEGIN { |
30
|
1
|
|
|
1
|
|
15
|
$events = events_table; |
31
|
1
|
|
|
|
|
5
|
push @constants, keys %$events; |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
1
|
@poll = qw(poll events_names); |
34
|
1
|
|
|
|
|
222
|
push @poll, grep /^POLL/, keys %$events; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub select($$$;$) |
39
|
0
|
0
|
|
0
|
1
|
|
{ push @_, undef if @_==3; |
40
|
0
|
|
|
|
|
|
goto &select; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
0
|
1
|
|
sub FD_CLR($$) {vec($_[1],$_[0],1) = 0} |
45
|
0
|
|
|
0
|
1
|
|
sub FD_ISSET($$) {vec($_[1],$_[0],1) ==1} |
46
|
0
|
|
|
0
|
1
|
|
sub FD_SET($$) {vec($_[1],$_[0],1) = 1} |
47
|
0
|
|
|
0
|
1
|
|
sub FD_ZERO($) {$_[0] = 0} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub poll($;$) |
51
|
0
|
|
|
0
|
1
|
|
{ my ($data, $timeout) = @_; |
52
|
0
|
0
|
|
|
|
|
defined $timeout or $timeout = -1; |
53
|
0
|
|
|
|
|
|
_poll($data, $timeout); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
#---------------------- |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
0
|
1
|
|
sub events_names() { keys %$events } |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub _create_constant($) |
61
|
0
|
|
|
0
|
|
|
{ my ($class, $name) = @_; |
62
|
0
|
|
0
|
0
|
|
|
my $val = $events->{$name} // return sub() {undef}; |
|
0
|
|
|
|
|
|
|
63
|
0
|
|
|
0
|
|
|
sub() {$val}; |
|
0
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
#---------------------- |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |