| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package POE::Component::Client::Stomp::Utils; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
24809
|
use 5.008; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
40
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
35
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
42
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
1000
|
use Net::Stomp::Frame; |
|
|
1
|
|
|
|
|
5979
|
|
|
|
1
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# ------------------------------------------------------------------- |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
|
14
|
0
|
|
|
0
|
1
|
|
my $proto = shift; |
|
15
|
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
my $self = {}; |
|
17
|
0
|
|
0
|
|
|
|
my $class = ref($proto) || $proto; |
|
18
|
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
$self->{transaction_id} = 0; |
|
20
|
0
|
|
|
|
|
|
$self->{session_id} = 0; |
|
21
|
0
|
|
|
|
|
|
$self->{message_id} = 0; |
|
22
|
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
|
bless($self, $class); |
|
24
|
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
return $self; |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# ------------------------------------------------------------------- |
|
30
|
|
|
|
|
|
|
# Mutators |
|
31
|
|
|
|
|
|
|
# ----------------------------------------------------------- |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub transaction_id { |
|
34
|
0
|
|
|
0
|
1
|
|
my ($self, $a) = @_; |
|
35
|
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
$self->{transaction_id} = $a if (defined $a); |
|
37
|
0
|
|
|
|
|
|
return $self->{transaction_id}; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub session_id { |
|
42
|
0
|
|
|
0
|
1
|
|
my ($self, $a) = @_; |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
$self->{session_id} = $a if (defined $a); |
|
45
|
0
|
|
|
|
|
|
return $self->{session_id}; |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub message_id { |
|
50
|
0
|
|
|
0
|
1
|
|
my ($self, $a) = @_; |
|
51
|
|
|
|
|
|
|
|
|
52
|
0
|
0
|
|
|
|
|
$self->{message_id} = $a if (defined $a); |
|
53
|
0
|
|
|
|
|
|
return $self->{message_id}; |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
# ----------------------------------------------------------- |
|
58
|
|
|
|
|
|
|
# Methods |
|
59
|
|
|
|
|
|
|
# ----------------------------------------------------------- |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub connect { |
|
62
|
0
|
|
|
0
|
1
|
|
my ($self, $params) = @_; |
|
63
|
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
my $body = ''; |
|
65
|
0
|
|
|
|
|
|
my $command = 'CONNECT'; |
|
66
|
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
return(Net::Stomp::Frame->new({command => $command, |
|
68
|
|
|
|
|
|
|
headers => $params, |
|
69
|
|
|
|
|
|
|
body => $body})); |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub subscribe { |
|
74
|
0
|
|
|
0
|
1
|
|
my ($self, $params) = @_; |
|
75
|
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
my $body = ''; |
|
77
|
0
|
|
|
|
|
|
my $command = 'SUBSCRIBE'; |
|
78
|
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
return(Net::Stomp::Frame->new({command => $command, |
|
80
|
|
|
|
|
|
|
headers => $params, |
|
81
|
|
|
|
|
|
|
body => $body})); |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub unsubscribe { |
|
86
|
0
|
|
|
0
|
1
|
|
my ($self, $params) = @_; |
|
87
|
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my $body = ''; |
|
89
|
0
|
|
|
|
|
|
my $command = 'UNSUBSCRIBE'; |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
return(Net::Stomp::Frame->new({command => $command, |
|
92
|
|
|
|
|
|
|
headers => $params, |
|
93
|
|
|
|
|
|
|
body => $body})); |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub begin { |
|
98
|
0
|
|
|
0
|
1
|
|
my ($self, $params) = @_; |
|
99
|
|
|
|
|
|
|
|
|
100
|
0
|
|
|
|
|
|
my $body = ''; |
|
101
|
0
|
|
|
|
|
|
my $command = 'BEGIN'; |
|
102
|
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
$self->transaction_id($params->{transaction}); |
|
104
|
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
return(Net::Stomp::Frame->new({command => $command, |
|
106
|
|
|
|
|
|
|
headers => $params, |
|
107
|
|
|
|
|
|
|
body => $body})); |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
sub commit { |
|
112
|
0
|
|
|
0
|
1
|
|
my ($self, $params) = @_; |
|
113
|
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
my $body = ''; |
|
115
|
0
|
|
|
|
|
|
my $command = 'COMMIT'; |
|
116
|
|
|
|
|
|
|
|
|
117
|
0
|
|
|
|
|
|
$params->{transaction} = $self->transaction_id; |
|
118
|
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
return(Net::Stomp::Frame->new({command => $command, |
|
120
|
|
|
|
|
|
|
headers => $params, |
|
121
|
|
|
|
|
|
|
body => $body})); |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
} |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
sub ack { |
|
126
|
0
|
|
|
0
|
1
|
|
my ($self, $params) = @_; |
|
127
|
|
|
|
|
|
|
|
|
128
|
0
|
|
|
|
|
|
my $body = ''; |
|
129
|
0
|
|
|
|
|
|
my $command = 'ACK'; |
|
130
|
|
|
|
|
|
|
|
|
131
|
0
|
0
|
|
|
|
|
$params->{transaction} = $self->transaction_id |
|
132
|
|
|
|
|
|
|
if ($self->{transaction_id} > 0); |
|
133
|
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
return(Net::Stomp::Frame->new({command => $command, |
|
135
|
|
|
|
|
|
|
headers => $params, |
|
136
|
|
|
|
|
|
|
body => $body})); |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
} |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
sub abort { |
|
141
|
0
|
|
|
0
|
1
|
|
my ($self, $params) = @_; |
|
142
|
|
|
|
|
|
|
|
|
143
|
0
|
|
|
|
|
|
my $body = ''; |
|
144
|
0
|
|
|
|
|
|
my $command = 'ABORT'; |
|
145
|
|
|
|
|
|
|
|
|
146
|
0
|
|
|
|
|
|
$params->{transaction} = $self->transaction_id; |
|
147
|
0
|
|
|
|
|
|
$self->{transaction_id} = 0; |
|
148
|
|
|
|
|
|
|
|
|
149
|
0
|
|
|
|
|
|
return(Net::Stomp::Frame->new({command => $command, |
|
150
|
|
|
|
|
|
|
headers => $params, |
|
151
|
|
|
|
|
|
|
body => $body})); |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
} |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
sub disconnect { |
|
156
|
0
|
|
|
0
|
1
|
|
my ($self, $params) = @_; |
|
157
|
|
|
|
|
|
|
|
|
158
|
0
|
|
|
|
|
|
my $body = ''; |
|
159
|
0
|
|
|
|
|
|
my $command = 'DISCONNECT'; |
|
160
|
|
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
|
return(Net::Stomp::Frame->new({command => $command, |
|
162
|
|
|
|
|
|
|
headers => $params, |
|
163
|
|
|
|
|
|
|
body => $body})); |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
} |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub send { |
|
168
|
0
|
|
|
0
|
1
|
|
my ($self, $params) = @_; |
|
169
|
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
|
my $body = $params->{data}; |
|
171
|
0
|
|
|
|
|
|
my $command = 'SEND'; |
|
172
|
|
|
|
|
|
|
|
|
173
|
0
|
|
|
|
|
|
delete $params->{data}; |
|
174
|
0
|
|
|
|
|
|
$params->{'content-length'} = length($body); |
|
175
|
|
|
|
|
|
|
|
|
176
|
0
|
|
|
|
|
|
return(Net::Stomp::Frame->new({command => $command, |
|
177
|
|
|
|
|
|
|
headers => $params, |
|
178
|
|
|
|
|
|
|
body => $body})); |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
} |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
1; |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
__END__ |