line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
1769
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
88
|
|
2
|
3
|
|
|
3
|
|
12
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
114
|
|
3
|
|
|
|
|
|
|
package Net::MQTT::Message::Subscribe; |
4
|
|
|
|
|
|
|
$Net::MQTT::Message::Subscribe::VERSION = '1.143260'; |
5
|
|
|
|
|
|
|
# ABSTRACT: Perl module to represent an MQTT Subscribe message |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
11
|
use base 'Net::MQTT::Message'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
185
|
|
9
|
3
|
|
|
3
|
|
13
|
use Net::MQTT::Constants qw/:all/; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
18
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub message_type { |
12
|
7
|
|
|
7
|
1
|
15
|
8 |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub _default_qos { |
16
|
2
|
|
|
2
|
|
6
|
MQTT_QOS_AT_LEAST_ONCE |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
4
|
1
|
12
|
sub message_id { shift->{message_id} } |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
2
|
|
|
2
|
1
|
5
|
sub topics { shift->{topics} } |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _topics_string { |
26
|
2
|
|
|
2
|
|
2
|
join ',', map { $_->[0].'/'.qos_string($_->[1]) } @{shift->{topics}} |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
4
|
|
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
|
|
2
|
my $self = shift; |
37
|
1
|
|
|
|
|
2
|
my $offset = 0; |
38
|
1
|
|
|
|
|
8
|
$self->{message_id} = decode_short($self->{remaining}, \$offset); |
39
|
1
|
|
|
|
|
5
|
while ($offset < length $self->{remaining}) { |
40
|
1
|
|
|
|
|
1
|
push @{$self->{topics}}, [ decode_string($self->{remaining}, \$offset), |
|
1
|
|
|
|
|
6
|
|
41
|
|
|
|
|
|
|
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
|
|
|
|
|
9
|
my $o = encode_short($self->message_id); |
49
|
2
|
|
|
|
|
3
|
foreach my $r (@{$self->topics}) { |
|
2
|
|
|
|
|
4
|
|
50
|
2
|
|
|
|
|
3
|
my ($name, $qos) = @$r; |
51
|
2
|
|
|
|
|
4
|
$o .= encode_string($name); |
52
|
2
|
|
|
|
|
4
|
$o .= encode_byte($qos); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
$o |
55
|
2
|
|
|
|
|
3
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
1; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
__END__ |