| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package IO::SocketAlarm; |
|
2
|
|
|
|
|
|
|
$IO::SocketAlarm::VERSION = '0.003'; |
|
3
|
|
|
|
|
|
|
# VERSION |
|
4
|
|
|
|
|
|
|
# ABSTRACT: Perform asynchronous actions when a socket changes status |
|
5
|
|
|
|
|
|
|
|
|
6
|
6
|
|
|
6
|
|
1217672
|
use strict; |
|
|
6
|
|
|
|
|
12
|
|
|
|
6
|
|
|
|
|
217
|
|
|
7
|
6
|
|
|
6
|
|
46
|
use warnings; |
|
|
6
|
|
|
|
|
14
|
|
|
|
6
|
|
|
|
|
314
|
|
|
8
|
6
|
|
|
6
|
|
24
|
use Carp; |
|
|
6
|
|
|
|
|
9
|
|
|
|
6
|
|
|
|
|
361
|
|
|
9
|
6
|
|
|
6
|
|
28
|
use Scalar::Util (); |
|
|
6
|
|
|
|
|
15
|
|
|
|
6
|
|
|
|
|
506
|
|
|
10
|
|
|
|
|
|
|
require XSLoader; |
|
11
|
|
|
|
|
|
|
XSLoader::load('IO::SocketAlarm', $IO::SocketAlarm::VERSION); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# All exports are part of the Util sub-package. |
|
14
|
|
|
|
|
|
|
{package IO::SocketAlarm::Util; |
|
15
|
|
|
|
|
|
|
$IO::SocketAlarm::Util::VERSION = '0.003'; |
|
16
|
|
|
|
|
|
|
our @EXPORT_OK= qw( socketalarm get_fd_table_str is_socket ); |
|
17
|
6
|
|
|
6
|
|
32
|
use Exporter 'import'; |
|
|
6
|
|
|
|
|
24
|
|
|
|
6
|
|
|
|
|
1737
|
|
|
18
|
|
|
|
|
|
|
# Declared in XS |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub import { |
|
22
|
6
|
|
|
6
|
|
56
|
splice(@_, 0, 1, 'IO::SocketAlarm::Util'); |
|
23
|
6
|
|
|
|
|
438886
|
goto \&IO::SocketAlarm::Util::import; |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub new { |
|
28
|
14
|
|
|
14
|
1
|
156387
|
my $class= shift; |
|
29
|
14
|
50
|
33
|
|
|
154
|
my %attrs= @_ == 1 && ref $_[0] eq 'HASH'? %{$_[0]} : @_; |
|
|
0
|
|
|
|
|
0
|
|
|
30
|
14
|
|
|
|
|
43
|
my $self= bless \%attrs, $class; |
|
31
|
14
|
|
|
|
|
229
|
$self->_init_socketalarm(@attrs{'socket','events','actions'}); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
2
|
|
|
2
|
1
|
776644
|
sub triggered { $_[0]->cur_action >= 0 } |
|
36
|
1
|
|
|
1
|
1
|
12
|
sub finished { $_[0]->cur_action >= $_[0]->action_count } |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Before global destruction, de-activate the alarms and ask the watcher thread to terminate. |
|
40
|
|
|
|
|
|
|
# This way bizarre things don't happen when global destruction starts calling destructors |
|
41
|
|
|
|
|
|
|
# in the wrong order. |
|
42
|
6
|
|
|
6
|
|
254927
|
END { _terminate_all() } |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |