line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Courriel::Role::Streams; |
2
|
|
|
|
|
|
|
|
3
|
10
|
|
|
10
|
|
5150
|
use strict; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
296
|
|
4
|
10
|
|
|
10
|
|
38
|
use warnings; |
|
10
|
|
|
|
|
14
|
|
|
10
|
|
|
|
|
265
|
|
5
|
10
|
|
|
10
|
|
39
|
use namespace::autoclean; |
|
10
|
|
|
|
|
14
|
|
|
10
|
|
|
|
|
60
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.42'; |
8
|
|
|
|
|
|
|
|
9
|
10
|
|
|
10
|
|
723
|
use Courriel::Types qw( Streamable ); |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
77
|
|
10
|
10
|
|
|
10
|
|
23903
|
use MooseX::Params::Validate qw( validated_list ); |
|
10
|
|
|
|
|
550053
|
|
|
10
|
|
|
|
|
59
|
|
11
|
|
|
|
|
|
|
|
12
|
10
|
|
|
10
|
|
1717
|
use Moose::Role; |
|
10
|
|
|
|
|
16
|
|
|
10
|
|
|
|
|
94
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
{ |
15
|
|
|
|
|
|
|
my @spec = ( output => { isa => Streamable, coerce => 1 } ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub stream_to { |
18
|
10
|
|
|
10
|
0
|
9
|
my $self = shift; |
19
|
10
|
|
|
|
|
30
|
my ($output) = validated_list( |
20
|
|
|
|
|
|
|
\@_, |
21
|
|
|
|
|
|
|
@spec, |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
10
|
|
|
|
|
10932
|
$self->_stream_to($output); |
25
|
|
|
|
|
|
|
|
26
|
10
|
|
|
|
|
15
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub as_string { |
31
|
10
|
|
|
10
|
0
|
43
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
10
|
|
|
|
|
9
|
my $string = q{}; |
34
|
|
|
|
|
|
|
|
35
|
10
|
|
|
|
|
20
|
$self->stream_to( output => $self->_string_output( \$string ) ); |
36
|
|
|
|
|
|
|
|
37
|
10
|
|
|
|
|
57
|
return $string; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _string_output { |
41
|
10
|
|
|
10
|
|
9
|
my $self = shift; |
42
|
10
|
|
|
|
|
6
|
my $stringref = shift; |
43
|
|
|
|
|
|
|
|
44
|
10
|
|
|
|
|
9
|
my $string = q{}; |
45
|
10
|
|
|
10
|
|
39
|
return sub { ${$stringref} .= $_ for @_ }; |
|
10
|
|
|
|
|
19
|
|
|
10
|
|
|
|
|
25
|
|
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |