Net/OBEX/Packet/Request/SetPath.pm

filter: Statementstmt 85.4% 41 / 48 Branchbran 50.0% 8 / 16 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 90.0% 9 / 10 Podpod 100% 6 / 6 totaltotal 76.4% 65 / 85 CC 11 SCAR 11.7
CC
11
Cov
75%
no_create
6.0
new
5.2
make
3.3
CRAP 3.2
« Net/OBEX/Packet/Headers/Base.pm ↑ Summary Net/OBEX/Packet/Headers.pm »
1 package Net::OBEX::Packet::Request::SetPath;
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  
6 7 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 7 ▶use base 'Net::OBEX::Packet::Request::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 7 our $VERSION = '1.001002'; # VERSION
9  
10 2 ▶sub new {
Subroutine new: called CC=5 SCAR=16.4
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 do_up => 0,
19 no_create => 1,
20 constants => "\x00",
21 headers => [],
22  
23 %args,
24 );
25  
26 2 my $self = bless \%args, $class;
27  
28 2 ▶ my $flags = $args{no_create} ? '1' : '0';
Branch: 1 branch
BranchTrueFalseTotal
$args{'no_create'} ? : 2 0 2
29 2 ▶ $flags .= $args{do_up} ? '1' : '0';
Branch: 1 branch
BranchTrueFalseTotal
$args{'do_up'} ? : 0 2 2
30 2 $self->flags( pack 'B8', '000000' . $flags );
31  
32 2 return $self;
33 }
34  
35 2 ▶sub make {
Subroutine make: called CC=3 SCAR=11.8
Pod documented
36 2 my $self = shift;
37  
38 2 my $packet;
39 2 my $headers = join '', @{ $self->headers };
40 2 ▶ if ( $self->do_up and not length $headers ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->do_up and not length $headers) { } 0 2 2
Condition33%1/3
$self->do_up and not length $headers
!ll&&!rl&&r
200
MC/DC0%0/2
$self->do_up and not length $headers
$self->do_up not length $headers
Truth table33%1/3
A and not(B)
A= $self->do_upB= not length $headers
ABresult
0X0
100
111
41 0 $packet = $self->flags . $self->constants;
42 }
43 else {
44 2 $packet = $self->flags . $self->constants . $headers;
45 }
46  
47 2 return $self->raw("\x85" . pack('n', 3 + length $packet) . $packet);
48 }
49  
50 4 ▶sub flags {
Subroutine flags: called CC=2 SCAR=6.9
Pod documented
51 4 my $self = shift;
52 4 ▶ if ( @_ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 2 2 4
53 2 $self->{ flags } = shift;
54 }
55 4 return $self->{ flags };
56 }
57  
58 2 ▶sub do_up {
Subroutine do_up: called CC=2 SCAR=7.6
Pod documented
59 2 my $self = shift;
60 2 ▶ if ( @_ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 2 2
61 0 $self->{ do_up } = shift;
62 }
63 2 return $self->{ do_up };
64 }
65  
66 2 ▶sub constants {
Subroutine constants: called CC=2 SCAR=7.6
Pod documented
67 2 my $self = shift;
68 2 ▶ if ( @_ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 2 2
69 0 $self->{ constants } = shift;
70 }
71 2 return $self->{ constants };
72 }
73  
74 0 ▶sub no_create {
Subroutine no_create: not called CC=2 SCAR=17.9
Pod documented
75 0 my $self = shift;
76 0 ▶ if ( @_ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
77 0 $self->{ no_create } = shift;
78 }
79 0 return $self->{ no_create };
80 }
81  
82 7 1;
83  
84 __END__
« Net/OBEX/Packet/Headers/Base.pm ↑ Summary Net/OBEX/Packet/Headers.pm »