Message/Unsubscribe.pm

filter: Statementstmt 100% 35 / 35 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 12 / 12 Podpod 100% 3 / 3 totaltotal 100% 52 / 52 CC 3 SCAR 2.5
CC
3
Cov
100%
_parse_remaining
2.0
_remaining_bytes
2.0
BEGIN
1.0
CRAP 1.3
« Message/Subscribe.pm ↑ Summary Message/Disconnect.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::Unsubscribe;
4 3 $Net::MQTT::Message::Unsubscribe::VERSION = '1.143250';
5 # ABSTRACT: Perl module to represent an MQTT Unsubscribe 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 7 ▶ 10
Subroutine message_type: called CC=1 SCAR=0.0
Pod documented
13 }
14  
15 sub _default_qos {
16 2 ▶ MQTT_QOS_AT_LEAST_ONCE
Subroutine _default_qos: called CC=1 SCAR=0.0
17 }
18  
19  
20 4 ▶sub message_id { shift->{message_id} }
Subroutine message_id: called CC=1 SCAR=0.0
Pod documented
21  
22  
23 2 ▶sub topics { shift->{topics} }
Subroutine topics: called CC=1 SCAR=0.0
Pod documented
24  
25 2 ▶sub _topics_string { join ',', @{shift->{topics}} }
Subroutine _topics_string: called CC=1 SCAR=0.0
26  
27 sub _remaining_string {
28 2 ▶ my ($self, $prefix) = @_;
Subroutine _remaining_string: called CC=1 SCAR=0.0
29 2 $self->message_id.' '.$self->_topics_string.' '.
30 $self->SUPER::_remaining_string($prefix)
31 }
32  
33 sub _parse_remaining {
34 1 ▶ my $self = shift;
Subroutine _parse_remaining: called CC=2 SCAR=6.9
35 1 my $offset = 0;
36 1 $self->{message_id} = decode_short($self->{remaining}, \$offset);
37 1 ▶ while ($offset < length $self->{remaining}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($offset < length $self->{"remaining"}) 1 1 2
38 1 push @{$self->{topics}}, decode_string($self->{remaining}, \$offset);
39 }
40 1 substr $self->{remaining}, 0, $offset, '';
41 }
42  
43 sub _remaining_bytes {
44 2 ▶ my $self = shift;
Subroutine _remaining_bytes: called CC=2 SCAR=6.9
45 2 my $o = encode_short($self->message_id);
46 2 foreach my $name (@{$self->topics}) {
47 2 $o .= encode_string($name);
48 }
49 $o
50 2 }
51  
52 3 1;
53  
54 __END__
« Message/Subscribe.pm ↑ Summary Message/Disconnect.pm »