| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 12 | ▶ | die "writer provided can't be called as code" unless $_[0]->does('JMAP::Tester::LogWriter'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | if _CODELIKE($value); | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 8 | ▶ | return JMAP::Tester::LogWriter::Handle->new({ handle => $value }) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition66%2/3
&_SCALAR0($value) and not defined $$value
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
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 1 | ▶ | if (defined $value && ! ref $value && length $value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
defined $value and not ref $value and length $value
defined $value and not ref $value
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
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | ▶ | if ($value =~ /\A-([1-9][0-9]*)\z/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | ▶ | open my $handle, '>&', "$1" | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||||||||||||