line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
494
|
use v5.14.0; |
|
1
|
|
|
|
|
3
|
|
2
|
|
|
|
|
|
|
package JMAP::Tester::Logger 0.103; |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
22
|
use Moo::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
739
|
use JMAP::Tester::LogWriter; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
7
|
1
|
|
|
1
|
|
8
|
use Params::Util qw(_CODELIKE _HANDLE _SCALAR0); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
135
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
8
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has writer => ( |
12
|
|
|
|
|
|
|
is => 'ro', |
13
|
|
|
|
|
|
|
isa => sub { |
14
|
|
|
|
|
|
|
die "no writer provided" unless $_[0]; |
15
|
|
|
|
|
|
|
die "writer provided can't be called as code" unless $_[0]->does('JMAP::Tester::LogWriter'); |
16
|
|
|
|
|
|
|
}, |
17
|
|
|
|
|
|
|
coerce => sub { |
18
|
|
|
|
|
|
|
my $value = $_[0]; |
19
|
|
|
|
|
|
|
return JMAP::Tester::LogWriter::Code->new({ code => $value }) |
20
|
|
|
|
|
|
|
if _CODELIKE($value); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
return JMAP::Tester::LogWriter::Handle->new({ handle => $value }) |
23
|
|
|
|
|
|
|
if _HANDLE($value); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
return JMAP::Tester::LogWriter::Code->new({ code => sub{} }) |
26
|
|
|
|
|
|
|
if _SCALAR0($value) && ! defined $$value; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
if (defined $value && ! ref $value && length $value) { |
29
|
|
|
|
|
|
|
if ($value =~ /\A-([1-9][0-9]*)\z/) { |
30
|
|
|
|
|
|
|
open my $handle, '>&', "$1" |
31
|
|
|
|
|
|
|
or die "can't dup fd $1 for logger output: $!"; |
32
|
|
|
|
|
|
|
$handle->autoflush(1); |
33
|
|
|
|
|
|
|
return JMAP::Tester::LogWriter::Handle->new({ handle => $handle }); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return JMAP::Tester::LogWriter::Filename->new({ |
37
|
|
|
|
|
|
|
filename_template => $value |
38
|
|
|
|
|
|
|
}); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return $value; |
42
|
|
|
|
|
|
|
}, |
43
|
|
|
|
|
|
|
required => 1, |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub write { |
47
|
0
|
|
|
0
|
0
|
|
my ($self, $string) = @_; |
48
|
0
|
|
|
|
|
|
$self->writer->write( $string ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
requires 'log_jmap_request'; |
52
|
|
|
|
|
|
|
requires 'log_jmap_response'; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
requires 'log_upload_request'; |
55
|
|
|
|
|
|
|
requires 'log_upload_response'; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
requires 'log_download_request'; |
58
|
|
|
|
|
|
|
requires 'log_download_response'; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |