line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Courriel::Role::Streams; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
7591
|
use strict; |
|
10
|
|
|
|
|
21
|
|
|
10
|
|
|
|
|
397
|
|
4
|
10
|
|
|
10
|
|
50
|
use warnings; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
359
|
|
5
|
10
|
|
|
10
|
|
50
|
use namespace::autoclean; |
|
10
|
|
|
|
|
108
|
|
|
10
|
|
|
|
|
88
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.44'; |
8
|
|
|
|
|
|
|
|
9
|
10
|
|
|
10
|
|
902
|
use Courriel::Types qw( Streamable ); |
|
10
|
|
|
|
|
20
|
|
|
10
|
|
|
|
|
90
|
|
10
|
10
|
|
|
10
|
|
31354
|
use Params::ValidationCompiler qw( validation_for ); |
|
10
|
|
|
|
|
188152
|
|
|
10
|
|
|
|
|
857
|
|
11
|
|
|
|
|
|
|
|
12
|
10
|
|
|
10
|
|
94
|
use Moose::Role; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
193
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
my $validator = validation_for( |
16
|
|
|
|
|
|
|
params => [ output => { type => Streamable } ], |
17
|
|
|
|
|
|
|
named_to_list => 1, |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub stream_to { |
21
|
10
|
|
|
10
|
0
|
16
|
my $self = shift; |
22
|
10
|
|
|
|
|
376
|
my ($output) = $validator->(@_); |
23
|
|
|
|
|
|
|
|
24
|
10
|
|
|
|
|
2282
|
$self->_stream_to($output); |
25
|
|
|
|
|
|
|
|
26
|
10
|
|
|
|
|
25
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub as_string { |
31
|
10
|
|
|
10
|
0
|
83
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
10
|
|
|
|
|
22
|
my $string = q{}; |
34
|
|
|
|
|
|
|
|
35
|
10
|
|
|
|
|
39
|
$self->stream_to( output => $self->_string_output( \$string ) ); |
36
|
|
|
|
|
|
|
|
37
|
10
|
|
|
|
|
114
|
return $string; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _string_output { |
41
|
10
|
|
|
10
|
|
17
|
my $self = shift; |
42
|
10
|
|
|
|
|
17
|
my $stringref = shift; |
43
|
|
|
|
|
|
|
|
44
|
10
|
|
|
|
|
16
|
my $string = q{}; |
45
|
10
|
|
|
10
|
|
88
|
return sub { ${$stringref} .= $_ for @_ }; |
|
10
|
|
|
|
|
37
|
|
|
10
|
|
|
|
|
48
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |