| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package RPC::ExtDirect::Event; |
|
2
|
|
|
|
|
|
|
|
|
3
|
13
|
|
|
13
|
|
3263
|
use strict; |
|
|
13
|
|
|
|
|
14
|
|
|
|
13
|
|
|
|
|
292
|
|
|
4
|
13
|
|
|
13
|
|
41
|
use warnings; |
|
|
13
|
|
|
|
|
13
|
|
|
|
13
|
|
|
|
|
269
|
|
|
5
|
13
|
|
|
13
|
|
47
|
no warnings 'uninitialized'; ## no critic |
|
|
13
|
|
|
|
|
16
|
|
|
|
13
|
|
|
|
|
285
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
13
|
|
|
13
|
|
44
|
use Carp; |
|
|
13
|
|
|
|
|
11
|
|
|
|
13
|
|
|
|
|
1183
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
13
|
|
|
13
|
|
674
|
use RPC::ExtDirect::Util::Accessor; |
|
|
13
|
|
|
|
|
18
|
|
|
|
13
|
|
|
|
|
2828
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
### PUBLIC CLASS METHOD (CONSTRUCTOR) ### |
|
12
|
|
|
|
|
|
|
# |
|
13
|
|
|
|
|
|
|
# Initialize a new Event instance |
|
14
|
|
|
|
|
|
|
# |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
|
17
|
18
|
|
|
18
|
1
|
1840
|
my $class = shift; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Allow passing either ordered parameters, or hashref, |
|
20
|
|
|
|
|
|
|
# or even a hash. This is to allow Mooseish and other |
|
21
|
|
|
|
|
|
|
# popular invocation patterns without having to pile on |
|
22
|
|
|
|
|
|
|
# argument converters or doing some other nonsense. |
|
23
|
18
|
|
|
|
|
15
|
my ($name, $data); |
|
24
|
|
|
|
|
|
|
|
|
25
|
18
|
100
|
|
|
|
47
|
if ( @_ == 1 ) { |
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
26
|
2
|
100
|
|
|
|
5
|
if ( 'HASH' eq ref $_[0] ) { |
|
27
|
1
|
|
|
|
|
1
|
$name = $_[0]->{name}; |
|
28
|
1
|
|
|
|
|
1
|
$data = $_[0]->{data}; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
else { |
|
31
|
1
|
|
|
|
|
1
|
$name = $_[0]; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
elsif ( @_ == 2 ) { |
|
35
|
14
|
|
|
|
|
13
|
$name = $_[0]; |
|
36
|
14
|
|
|
|
|
15
|
$data = $_[1]; |
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
elsif ( @_ % 2 == 0 ) { |
|
39
|
2
|
|
|
|
|
3
|
my %arg = @_; |
|
40
|
|
|
|
|
|
|
|
|
41
|
2
|
|
|
|
|
2
|
$name = $arg{name}; |
|
42
|
2
|
|
|
|
|
3
|
$data = $arg{data}; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
18
|
100
|
|
|
|
152
|
croak "Ext.Direct Event name is required" |
|
46
|
|
|
|
|
|
|
unless defined $name; |
|
47
|
|
|
|
|
|
|
|
|
48
|
17
|
|
|
|
|
41
|
my $self = bless { name => $name, data => $data }, $class; |
|
49
|
|
|
|
|
|
|
|
|
50
|
17
|
|
|
|
|
44
|
return $self; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
### PUBLIC INSTANCE METHOD ### |
|
54
|
|
|
|
|
|
|
# |
|
55
|
|
|
|
|
|
|
# A stub for duck typing. Does nothing, returns failure. |
|
56
|
|
|
|
|
|
|
# |
|
57
|
|
|
|
|
|
|
|
|
58
|
0
|
|
|
0
|
1
|
0
|
sub run { !1 } |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
### PUBLIC INSTANCE METHOD ### |
|
61
|
|
|
|
|
|
|
# |
|
62
|
|
|
|
|
|
|
# Returns hashref with Event data. Named so for compatibility with |
|
63
|
|
|
|
|
|
|
# Exceptions and Requests. |
|
64
|
|
|
|
|
|
|
# |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub result { |
|
67
|
17
|
|
|
17
|
1
|
4759
|
my ($self) = @_; |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
return { |
|
70
|
17
|
|
|
|
|
342
|
type => 'event', |
|
71
|
|
|
|
|
|
|
name => $self->name, |
|
72
|
|
|
|
|
|
|
data => $self->data, |
|
73
|
|
|
|
|
|
|
}; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
### PUBLIC INSTANCE METHODS ### |
|
77
|
|
|
|
|
|
|
# |
|
78
|
|
|
|
|
|
|
# Simple read-write accessors |
|
79
|
|
|
|
|
|
|
# |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
RPC::ExtDirect::Util::Accessor::mk_accessors( |
|
82
|
|
|
|
|
|
|
simple => [qw/ name data /], |
|
83
|
|
|
|
|
|
|
); |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |