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