line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package JLogger::Transport; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
681
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
459
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Carp; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
9
|
1
|
|
|
1
|
0
|
8741
|
my ($class, %args) = @_; |
10
|
|
|
|
|
|
|
|
11
|
1
|
50
|
|
|
|
6
|
Carp::croak('Required "host" argument missing!') |
12
|
|
|
|
|
|
|
unless exists $args{host}; |
13
|
|
|
|
|
|
|
|
14
|
1
|
50
|
|
|
|
4
|
Carp::croak('Required "port" argument missing!') |
15
|
|
|
|
|
|
|
unless exists $args{port}; |
16
|
|
|
|
|
|
|
|
17
|
1
|
50
|
|
|
|
8
|
Carp::croak('Required "secret" argument missing!') |
18
|
|
|
|
|
|
|
unless exists $args{secret}; |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
50
|
0
|
|
10
|
$args{on_disconnect} ||= sub {}; |
|
0
|
|
|
|
|
0
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
|
|
6
|
my $self = bless {%args}, $class; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
6
|
$self->init; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
4
|
$self; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
0
|
0
|
0
|
sub domain { $_[0]->{domain} } |
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
0
|
1
|
0
|
sub host { $_[0]->{host} } |
32
|
|
|
|
|
|
|
|
33
|
0
|
|
|
0
|
1
|
0
|
sub port { $_[0]->{port} } |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
0
|
1
|
0
|
sub secret { $_[0]->{secret} } |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub on_message { |
38
|
0
|
0
|
|
0
|
1
|
0
|
@_ > 1 ? $_[0]->{on_message} = $_[1] : $_[0]->{on_message}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub on_disconnect { |
42
|
0
|
0
|
|
0
|
0
|
0
|
@_ > 1 ? $_[0]->{on_disconnect} = $_[1] : $_[0]->{on_disconnect}; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
1
|
|
|
1
|
1
|
1
|
sub init { |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub connect { |
50
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
Carp::croak(qq(You didn't implemented "connect" in @{[ ref $self ]})); |
|
0
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub disconnect { |
56
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
57
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
Carp::croak(qq(You didn't implemented "disconnect" in @{[ ref $self ]})); |
|
0
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
__END__ |