Message/Publish.pm

filter: Statementstmt 100% 33 / 33 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod 100% 4 / 4 totaltotal 100% 55 / 55 CC 4 SCAR 3.4
CC
4
Cov
100%
_remaining_string
2.0
_parse_remaining
2.0
_remaining_bytes
2.0
CRAP 1.4
« Constants.pm ↑ Summary Message/ConnAck.pm »
1 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package Net::MQTT::Message::Publish;
4 3 $Net::MQTT::Message::Publish::VERSION = '1.143250';
5 # ABSTRACT: Perl module to represent an MQTT Publish message
6  
7  
8 3 ▶use base 'Net::MQTT::Message';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use Net::MQTT::Constants qw/:all/;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub message_type {
12 11 ▶ 3
Subroutine message_type: called CC=1 SCAR=0.0
Pod documented
13 }
14  
15  
16 8 ▶sub topic { shift->{topic} }
Subroutine topic: called CC=1 SCAR=0.0
Pod documented
17  
18  
19 4 ▶sub message_id { shift->{message_id} }
Subroutine message_id: called CC=1 SCAR=0.0
Pod documented
20  
21  
22 4 ▶sub message { shift->{message} }
Subroutine message: called CC=1 SCAR=0.0
Pod documented
23  
24 4 ▶sub _message_string { shift->{message} }
Subroutine _message_string: called CC=1 SCAR=0.0
25  
26 sub _remaining_string {
27 4 ▶ my $self = shift;
Subroutine _remaining_string: called CC=2 SCAR=6.9
28 4 ▶ $self->topic.
Branch: 1 branch
BranchTrueFalseTotal
$self->qos ? : 2 2 4
29 ($self->qos ? '/'.$self->message_id : '').
30 ' '.dump_string($self->_message_string)
31 }
32  
33 sub _parse_remaining {
34 2 ▶ my $self = shift;
Subroutine _parse_remaining: called CC=2 SCAR=6.9
35 2 my $offset = 0;
36 2 $self->{topic} = decode_string($self->{remaining}, \$offset);
37 2 ▶ $self->{message_id} = decode_short($self->{remaining}, \$offset)
Branch: 1 branch
BranchTrueFalseTotal
if $self->qos 1 1 2
38 if ($self->qos);
39 2 $self->{message} = substr $self->{remaining}, $offset;
40 2 $self->{remaining} = '';
41 }
42  
43 sub _remaining_bytes {
44 4 ▶ my $self = shift;
Subroutine _remaining_bytes: called CC=2 SCAR=6.9
45 4 my $o = encode_string($self->topic);
46 4 ▶ if ($self->qos) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->qos) 2 2 4
47 2 $o .= encode_short($self->message_id);
48 }
49 4 $o .= $self->message;
50 4 $o;
51 }
52  
53 3 1;
54  
55 __END__
« Constants.pm ↑ Summary Message/ConnAck.pm »