line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#+############################################################################## |
2
|
|
|
|
|
|
|
# # |
3
|
|
|
|
|
|
|
# File: Net/STOMP/Client/Peer.pm # |
4
|
|
|
|
|
|
|
# # |
5
|
|
|
|
|
|
|
# Description: Peer support for Net::STOMP::Client # |
6
|
|
|
|
|
|
|
# # |
7
|
|
|
|
|
|
|
#-############################################################################## |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# module definition |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Net::STOMP::Client::Peer; |
14
|
2
|
|
|
2
|
|
8
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
44
|
|
15
|
2
|
|
|
2
|
|
7
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
126
|
|
16
|
|
|
|
|
|
|
our $VERSION = "2.3"; |
17
|
|
|
|
|
|
|
our $REVISION = sprintf("%d.%02d", q$Revision: 2.1 $ =~ /(\d+)\.(\d+)/); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# |
20
|
|
|
|
|
|
|
# used modules |
21
|
|
|
|
|
|
|
# |
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
2
|
|
443
|
use Params::Validate qw(validate :types); |
|
2
|
|
|
|
|
6122
|
|
|
2
|
|
|
|
|
313
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# |
26
|
|
|
|
|
|
|
# constants |
27
|
|
|
|
|
|
|
# |
28
|
|
|
|
|
|
|
|
29
|
2
|
|
|
2
|
|
9
|
use constant I_PROTO => 0; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
101
|
|
30
|
2
|
|
|
2
|
|
8
|
use constant I_HOST => 1; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
77
|
|
31
|
2
|
|
|
2
|
|
6
|
use constant I_PORT => 2; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
67
|
|
32
|
2
|
|
|
2
|
|
6
|
use constant I_ADDR => 3; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
651
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
#+++############################################################################ |
35
|
|
|
|
|
|
|
# # |
36
|
|
|
|
|
|
|
# constructor # |
37
|
|
|
|
|
|
|
# # |
38
|
|
|
|
|
|
|
#---############################################################################ |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
my %new_options = ( |
41
|
|
|
|
|
|
|
"proto" => { |
42
|
|
|
|
|
|
|
type => SCALAR, |
43
|
|
|
|
|
|
|
regex => qr/^(tcp|ssl|stomp|stomp\+ssl)$/, |
44
|
|
|
|
|
|
|
}, |
45
|
|
|
|
|
|
|
"host" => { |
46
|
|
|
|
|
|
|
type => SCALAR, |
47
|
|
|
|
|
|
|
regex => qr/^[a-z0-9\.\-]+$/, |
48
|
|
|
|
|
|
|
}, |
49
|
|
|
|
|
|
|
"port" => { |
50
|
|
|
|
|
|
|
type => SCALAR, |
51
|
|
|
|
|
|
|
regex => qr/^\d+$/, |
52
|
|
|
|
|
|
|
}, |
53
|
|
|
|
|
|
|
"addr" => { |
54
|
|
|
|
|
|
|
optional => 1, |
55
|
|
|
|
|
|
|
type => SCALAR, |
56
|
|
|
|
|
|
|
regex => qr/^\d+\.\d+\.\d+\.\d+$/, |
57
|
|
|
|
|
|
|
}, |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub new : method { |
61
|
13
|
|
|
13
|
1
|
13
|
my($class, %option, $object); |
62
|
|
|
|
|
|
|
|
63
|
13
|
|
|
|
|
12
|
$class = shift(@_); |
64
|
13
|
|
|
|
|
157
|
%option = validate(@_, \%new_options); |
65
|
13
|
|
|
|
|
323
|
$object = [ @option{ qw(proto host port addr) } ]; |
66
|
13
|
|
|
|
|
51
|
return(bless($object, $class)); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
#+++############################################################################ |
70
|
|
|
|
|
|
|
# # |
71
|
|
|
|
|
|
|
# getters # |
72
|
|
|
|
|
|
|
# # |
73
|
|
|
|
|
|
|
#---############################################################################ |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub proto : method { |
76
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
return($self->[I_PROTO]); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
sub host : method { |
82
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
return($self->[I_HOST]); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub port : method { |
88
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
89
|
|
|
|
|
|
|
|
90
|
0
|
|
|
|
|
|
return($self->[I_PORT]); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub addr : method { |
94
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
95
|
|
|
|
|
|
|
|
96
|
0
|
|
|
|
|
|
return($self->[I_ADDR]); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
sub uri : method { |
100
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
return(sprintf("%s://%s:%s", @{ $self }[I_PROTO, I_HOST, I_PORT])); |
|
0
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
__END__ |