line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
2193
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
98
|
|
2
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
198
|
|
3
|
|
|
|
|
|
|
package Net::MQTT::Message::Subscribe; |
4
|
|
|
|
|
|
|
$Net::MQTT::Message::Subscribe::VERSION = '1.163170'; |
5
|
|
|
|
|
|
|
# ABSTRACT: Perl module to represent an MQTT Subscribe message |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
15
|
use base 'Net::MQTT::Message'; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
224
|
|
9
|
3
|
|
|
3
|
|
15
|
use Net::MQTT::Constants qw/:all/; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
18
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub message_type { |
12
|
7
|
|
|
7
|
1
|
16
|
8 |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _default_qos { |
16
|
2
|
|
|
2
|
|
8
|
MQTT_QOS_AT_LEAST_ONCE |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
4
|
1
|
14
|
sub message_id { shift->{message_id} } |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
2
|
1
|
6
|
sub topics { shift->{topics} } |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _topics_string { |
26
|
2
|
|
|
2
|
|
3
|
join ',', map { $_->[0].'/'.qos_string($_->[1]) } @{shift->{topics}} |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
5
|
|
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _remaining_string { |
30
|
2
|
|
|
2
|
|
4
|
my ($self, $prefix) = @_; |
31
|
2
|
|
|
|
|
5
|
$self->message_id.' '.$self->_topics_string.' '. |
32
|
|
|
|
|
|
|
$self->SUPER::_remaining_string($prefix) |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _parse_remaining { |
36
|
1
|
|
|
1
|
|
4
|
my $self = shift; |
37
|
1
|
|
|
|
|
2
|
my $offset = 0; |
38
|
1
|
|
|
|
|
8
|
$self->{message_id} = decode_short($self->{remaining}, \$offset); |
39
|
1
|
|
|
|
|
6
|
while ($offset < length $self->{remaining}) { |
40
|
1
|
|
|
|
|
6
|
push @{$self->{topics}}, [ decode_string($self->{remaining}, \$offset), |
41
|
1
|
|
|
|
|
2
|
decode_byte($self->{remaining}, \$offset) ]; |
42
|
|
|
|
|
|
|
} |
43
|
1
|
|
|
|
|
4
|
substr $self->{remaining}, 0, $offset, ''; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _remaining_bytes { |
47
|
2
|
|
|
2
|
|
3
|
my $self = shift; |
48
|
2
|
|
|
|
|
5
|
my $o = encode_short($self->message_id); |
49
|
2
|
|
|
|
|
4
|
foreach my $r (@{$self->topics}) { |
|
2
|
|
|
|
|
5
|
|
50
|
2
|
|
|
|
|
4
|
my ($name, $qos) = @$r; |
51
|
2
|
|
|
|
|
6
|
$o .= encode_string($name); |
52
|
2
|
|
|
|
|
5
|
$o .= encode_byte($qos); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
$o |
55
|
2
|
|
|
|
|
5
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |