line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package RPC::ExtDirect::Request::PollHandler; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# This private class implements overrides for Request |
4
|
|
|
|
|
|
|
# to be used with EventProvider |
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
6
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
48
|
|
7
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
67
|
|
8
|
2
|
|
|
2
|
|
6
|
no warnings 'uninitialized'; ## no critic |
|
2
|
|
|
|
|
219
|
|
|
2
|
|
|
|
|
66
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
8
|
use base 'RPC::ExtDirect::Request'; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
641
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
### PUBLIC CLASS METHOD (CONSTRUCTOR) ### |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# Initializes new instance of RPC::ExtDirect::Request |
15
|
|
|
|
|
|
|
# |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
9
|
|
|
9
|
0
|
12
|
my ($class, $arg) = @_; |
19
|
|
|
|
|
|
|
|
20
|
9
|
|
|
|
|
30
|
my $self = $class->SUPER::new($arg); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# We can't return exceptions from poll handler anyway |
23
|
9
|
50
|
|
|
|
26
|
return $self->{message} ? undef : $self; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
### PUBLIC INSTANCE METHOD ### |
27
|
|
|
|
|
|
|
# |
28
|
|
|
|
|
|
|
# Checks if method arguments are in order |
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub check_arguments { |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# There are no parameters to poll handlers |
34
|
|
|
|
|
|
|
# so we return undef which means no error |
35
|
9
|
|
|
9
|
0
|
12
|
return undef; ## no critic |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
### PUBLIC INSTANCE METHOD ### |
39
|
|
|
|
|
|
|
# |
40
|
|
|
|
|
|
|
# Return Events data extracted |
41
|
|
|
|
|
|
|
# |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub result { |
44
|
9
|
|
|
9
|
0
|
6
|
my ($self) = @_; |
45
|
|
|
|
|
|
|
|
46
|
9
|
|
|
|
|
9
|
my $events = $self->{result}; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# A hook can return something that is not an event list |
49
|
9
|
100
|
|
|
|
21
|
$events = [] unless 'ARRAY' eq ref $events; |
50
|
|
|
|
|
|
|
|
51
|
9
|
|
|
|
|
16
|
return map { $_->result } @$events; |
|
8
|
|
|
|
|
18
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
############## PRIVATE METHODS BELOW ############## |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
### PRIVATE INSTANCE METHOD ### |
57
|
|
|
|
|
|
|
# |
58
|
|
|
|
|
|
|
# Handles errors |
59
|
|
|
|
|
|
|
# |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub _set_error { |
62
|
2
|
|
|
2
|
|
2
|
my ($self) = @_; |
63
|
|
|
|
|
|
|
|
64
|
2
|
|
|
|
|
10
|
$self->{result} = []; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |