Net/OBEX/Packet/Request/Put.pm

filter: Statementstmt 96.7% 30 / 31 Branchbran 50.0% 3 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 3 / 3 totaltotal 91.4% 43 / 47 CC 5 SCAR 6.6
CC
5
Cov
89%
new
3.0
is_final
2.1
make
2.0
CRAP 1.9
« Net/OBEX/Packet/Request/Get.pm ↑ Summary Net/OBEX/Packet/Request/Connect.pm »
1 package Net::OBEX::Packet::Request::Put;
2  
3 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 7 our $VERSION = '1.001002'; # VERSION
6 7 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 7 ▶use base 'Net::OBEX::Packet::Request::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # opcodes 0x02 (0x82)
11  
12 2 ▶sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod documented
13 2 my $class = shift;
14 2 ▶ croak "Must have even number of arguments to new()"
Branch: 1 branch
BranchTrueFalseTotal
if @_ & 1 0 2 2
15 if @_ & 1;
16 2 my %args = @_;
17 2 $args{ +lc } = delete $args{ $_ } for keys %args;
18  
19 2 %args = (
20 is_final => 0,
21 headers => [],
22  
23 %args,
24 );
25  
26 2 return bless \%args, $class;
27 }
28  
29 2 ▶sub make {
Subroutine make: called CC=2 SCAR=7.0
Pod documented
30 2 my $self = shift;
31  
32 2 ▶ my $packet = $self->is_final() ? "\x82" : "\x02";
Branch: 1 branch
BranchTrueFalseTotal
$self->is_final ? : 0 2 2
33 2 my $headers = join '', @{$self->headers};
34 2 $packet .= pack 'n', 3+length $headers;
35 2 $packet .= $headers;
36  
37 2 return $self->raw($packet);
38 }
39  
40 2 ▶sub is_final {
Subroutine is_final: called CC=2 SCAR=7.6
Pod documented
41 2 my $self = shift;
42 2 ▶ if ( @_ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 2 2
43 0 $self->{ is_final } = shift;
44 }
45 2 return $self->{ is_final };
46 }
47  
48 7 1;
49  
50 __END__
« Net/OBEX/Packet/Request/Get.pm ↑ Summary Net/OBEX/Packet/Request/Connect.pm »