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