line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ZMQ::Raw::Timer; |
2
|
|
|
|
|
|
|
$ZMQ::Raw::Timer::VERSION = '0.38'; |
3
|
14
|
|
|
14
|
|
102
|
use strict; |
|
14
|
|
|
|
|
28
|
|
|
14
|
|
|
|
|
388
|
|
4
|
14
|
|
|
14
|
|
69
|
use warnings; |
|
14
|
|
|
|
|
25
|
|
|
14
|
|
|
|
|
341
|
|
5
|
14
|
|
|
14
|
|
74
|
use Carp; |
|
14
|
|
|
|
|
29
|
|
|
14
|
|
|
|
|
741
|
|
6
|
14
|
|
|
14
|
|
81
|
use ZMQ::Raw; |
|
14
|
|
|
|
|
23
|
|
|
14
|
|
|
|
|
3096
|
|
7
|
|
|
|
|
|
|
|
8
|
0
|
|
|
0
|
|
0
|
sub CLONE_SKIP { 1 } |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
ZMQ::Raw::Timer - ZeroMQ Timer class |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 VERSION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
version 0.38 |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 DESCRIPTION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
A L represents a timer. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
B: The API of this module is unstable and may change without warning |
23
|
|
|
|
|
|
|
(any change will be appropriately documented in the changelog). |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 SYNOPSIS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
use ZMQ::Raw; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Create a 200ms timer |
30
|
|
|
|
|
|
|
my $timer = ZMQ::Raw::Timer->new ($ctx, |
31
|
|
|
|
|
|
|
after => 200 |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 METHODS |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 new( $context, %args ) |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Create a new timer class. C<%args> may have 2 optional members, |
39
|
|
|
|
|
|
|
C to specify the number of milliseconds before the timer |
40
|
|
|
|
|
|
|
will initially fire, and/or C if the timer has to fire |
41
|
|
|
|
|
|
|
repeatedly. |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new |
46
|
|
|
|
|
|
|
{ |
47
|
24
|
|
|
24
|
1
|
7186
|
my ($class, $ctx, %args) = @_; |
48
|
24
|
|
50
|
|
|
5662
|
return $class->_new ($ctx, $args{after} || 0, $args{interval}); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub cancel |
54
|
|
|
|
|
|
|
{ |
55
|
14
|
|
|
14
|
1
|
39
|
my ($this) = @_; |
56
|
14
|
|
|
|
|
143
|
$this->_cancel(); |
57
|
|
|
|
|
|
|
|
58
|
18
|
100
|
|
|
|
123
|
AGAIN: |
59
|
|
|
|
|
|
|
goto AGAIN if (defined ($this->socket->recv (ZMQ::Raw->ZMQ_DONTWAIT))); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
sub reset |
65
|
|
|
|
|
|
|
{ |
66
|
27
|
|
|
27
|
1
|
72
|
my ($this) = @_; |
67
|
27
|
|
|
|
|
683
|
$this->_reset(); |
68
|
|
|
|
|
|
|
|
69
|
27
|
50
|
|
|
|
313
|
AGAIN: |
70
|
|
|
|
|
|
|
goto AGAIN if (defined ($this->socket->recv (ZMQ::Raw->ZMQ_DONTWAIT))); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 id () |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Get the timer's id |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head2 reset( ) |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Reset the timer |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 cancel( ) |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Cancel the timer |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 expire( ) |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Expire the timer |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 socket( ) |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Get the underlying L> that will be readable |
92
|
|
|
|
|
|
|
when the timer has elapsed. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 running( ) |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Check if the timer is running. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head2 interval( [$interval] ) |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Get and/or adjust the timer's interval. C<$interval> should be greater |
101
|
|
|
|
|
|
|
than zero. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 AUTHOR |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Jacques Germishuys |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Copyright 2017 Jacques Germishuys. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
112
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
113
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=cut |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
1; # End of ZMQ::Raw::Socket |