Tester/Logger.pm

filter: Statementstmt 90.2% 37 / 41 Branchbran 62.5% 10 / 16 Conditioncond 44.4% 4 / 9 MC/DCmcdc 20.0% 1 / 5 Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 1 totaltotal 75.6% 62 / 82 CC 12 SCAR 21.8
CC
12
Cov
77%
__ANON__
16.7
__ANON__
3.3
BEGIN
1.0
CRAP 8.8
↑ Summary Tester/UA/Async.pm »
1 3 ▶use v5.20.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package JMAP::Tester::Logger 0.113;
3  
4 3 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use experimental 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶use JMAP::Tester::LogWriter;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use Params::Util qw(_CODELIKE _HANDLE _SCALAR0);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 has writer => (
14 is => 'ro',
15 12 ▶ isa => sub {
Subroutine __ANON__: called CC=3 SCAR=12.0
16 12 ▶ die "no writer provided" unless $_[0];
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0] 0 12 12
17 12 ▶ die "writer provided can't be called as code" unless $_[0]->does('JMAP::Tester::LogWriter');
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0]->does("JMAP::Tester::LogWriter") 0 12 12
18 },
19 12 ▶ coerce => sub {
Subroutine __ANON__: called CC=10 SCAR=28.2
20 12 my $value = $_[0];
21 12 ▶ return JMAP::Tester::LogWriter::Code->new({ code => $value })
Branch: 1 branch
BranchTrueFalseTotal
if &_CODELIKE($value) 4 8 12
22 if _CODELIKE($value);
23  
24 8 ▶ return JMAP::Tester::LogWriter::Handle->new({ handle => $value })
Branch: 1 branch
BranchTrueFalseTotal
if _HANDLE($value) 1 7 8
25 if _HANDLE($value);
26  
27 1 ▶ return JMAP::Tester::LogWriter::Code->new({ code => sub{} })
Subroutine __ANON__: called CC=1 SCAR=0.0
28 7 ▶ if _SCALAR0($value) && ! defined $$value;
Branch: 1 branch
BranchTrueFalseTotal
if &_SCALAR0($value) and not defined $$value 6 1 7
Condition66%2/3
&_SCALAR0($value) and not defined $$value
!ll&&!rl&&r
106
MC/DC50%1/2
&_SCALAR0($value) and not defined $$value
&_SCALAR0($value) not defined $$value
Truth table66%2/3
A and not(B)
A= &_SCALAR0($value)B= not defined $$value
ABresult
0X0
100
111
29  
30 1 ▶ if (defined $value && ! ref $value && length $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value and not ref $value and length $value) 1 0 1
Condition33%2/6
defined $value and not ref $value and length $value
!ll&&!rl&&r
001
defined $value and not ref $value
!ll&&!rl&&r
001
MC/DC0%0/3
defined $value and not ref $value and length $value
defined $value not ref $value length $value
Truth table25%1/4
A and not(B) and C
A= defined $valueB= not ref $valueC= length $value
ABCresult
0XX0
10X0
1100
1111
31 1 ▶ if ($value =~ /\A-([1-9][0-9]*)\z/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($value =~ /\A-([1-9][0-9]*)\z/u) 0 1 1
32 0 ▶ open my $handle, '>&', "$1"
Branch: 1 branch
BranchTrueFalseTotal
open my $handle, ">&", "$1" or die "can't dup fd $1 for logger output: $!" 0 0 0
33 or die "can't dup fd $1 for logger output: $!";
34 0 $handle->autoflush(1);
35 0 return JMAP::Tester::LogWriter::Handle->new({ handle => $handle });
36 }
37  
38 1 return JMAP::Tester::LogWriter::Filename->new({
39 filename_template => $value
40 });
41 }
42  
43 0 return $value;
44 },
45 3 required => 1,
46 );
47  
48 15 ▶sub write ($self, $string) {
Subroutine write: called CC=1 SCAR=0.0
Pod undocumented
49 15 $self->writer->write( $string );
50 }
51  
52 3 requires 'log_jmap_request';
53 3 requires 'log_jmap_response';
54  
55 3 requires 'log_misc_request';
56 3 requires 'log_misc_response';
57  
58 3 requires 'log_upload_request';
59 3 requires 'log_upload_response';
60  
61 3 requires 'log_download_request';
62 3 requires 'log_download_response';
63  
64 3 1;
65  
66 __END__
↑ Summary Tester/UA/Async.pm »