line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
1696
|
use strict; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
92
|
|
2
|
3
|
|
|
3
|
|
10
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
114
|
|
3
|
|
|
|
|
|
|
package Net::MQTT::Message::Publish; |
4
|
|
|
|
|
|
|
$Net::MQTT::Message::Publish::VERSION = '1.143250'; |
5
|
|
|
|
|
|
|
# ABSTRACT: Perl module to represent an MQTT Publish message |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
3
|
|
|
3
|
|
12
|
use base 'Net::MQTT::Message'; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
184
|
|
9
|
3
|
|
|
3
|
|
12
|
use Net::MQTT::Constants qw/:all/; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
12
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub message_type { |
12
|
11
|
|
|
11
|
1
|
22
|
3 |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
8
|
|
|
8
|
1
|
19
|
sub topic { shift->{topic} } |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
19
|
4
|
|
|
4
|
1
|
11
|
sub message_id { shift->{message_id} } |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
4
|
|
|
4
|
1
|
6
|
sub message { shift->{message} } |
23
|
|
|
|
|
|
|
|
24
|
4
|
|
|
4
|
|
10
|
sub _message_string { shift->{message} } |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub _remaining_string { |
27
|
4
|
|
|
4
|
|
6
|
my $self = shift; |
28
|
4
|
100
|
|
|
|
7
|
$self->topic. |
29
|
|
|
|
|
|
|
($self->qos ? '/'.$self->message_id : ''). |
30
|
|
|
|
|
|
|
' '.dump_string($self->_message_string) |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _parse_remaining { |
34
|
2
|
|
|
2
|
|
3
|
my $self = shift; |
35
|
2
|
|
|
|
|
4
|
my $offset = 0; |
36
|
2
|
|
|
|
|
10
|
$self->{topic} = decode_string($self->{remaining}, \$offset); |
37
|
2
|
100
|
|
|
|
9
|
$self->{message_id} = decode_short($self->{remaining}, \$offset) |
38
|
|
|
|
|
|
|
if ($self->qos); |
39
|
2
|
|
|
|
|
6
|
$self->{message} = substr $self->{remaining}, $offset; |
40
|
2
|
|
|
|
|
5
|
$self->{remaining} = ''; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub _remaining_bytes { |
44
|
4
|
|
|
4
|
|
3
|
my $self = shift; |
45
|
4
|
|
|
|
|
8
|
my $o = encode_string($self->topic); |
46
|
4
|
100
|
|
|
|
8
|
if ($self->qos) { |
47
|
2
|
|
|
|
|
4
|
$o .= encode_short($self->message_id); |
48
|
|
|
|
|
|
|
} |
49
|
4
|
|
|
|
|
7
|
$o .= $self->message; |
50
|
4
|
|
|
|
|
7
|
$o; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |