line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Text::APL::Writer; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
52228
|
use strict; |
|
3
|
|
|
|
|
12
|
|
|
3
|
|
|
|
|
63
|
|
4
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
60
|
|
5
|
|
|
|
|
|
|
|
6
|
3
|
|
|
3
|
|
11
|
use base 'Text::APL::Base'; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
775
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub build { |
9
|
26
|
|
|
26
|
1
|
32
|
my $self = shift; |
10
|
26
|
|
|
|
|
37
|
my ($output) = @_; |
11
|
|
|
|
|
|
|
|
12
|
26
|
|
|
|
|
29
|
my $writer; |
13
|
|
|
|
|
|
|
|
14
|
26
|
100
|
|
|
|
83
|
if (!ref $output) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
15
|
1
|
50
|
|
|
|
76
|
open my $fh, '>', $output or die "Can't write to '$output': $!"; |
16
|
1
|
|
|
1
|
|
6
|
$writer = sub { print $fh $_[0] }; |
|
1
|
|
|
|
|
43
|
|
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
elsif (ref $output eq 'GLOB') { |
19
|
1
|
|
|
1
|
|
13
|
$writer = sub { print $output $_[0] }; |
|
1
|
|
|
|
|
10
|
|
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
elsif (ref $output eq 'SCALAR') { |
22
|
23
|
|
|
|
|
58
|
${$output} = ''; |
|
23
|
|
|
|
|
36
|
|
23
|
23
|
100
|
|
47
|
|
75
|
$writer = sub { ${$output} .= $_[0] if defined $_[0] }; |
|
47
|
|
|
|
|
280
|
|
|
25
|
|
|
|
|
199
|
|
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
elsif (ref $output eq 'CODE') { |
26
|
1
|
|
|
|
|
2
|
$writer = $output; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
else { |
29
|
0
|
|
|
|
|
0
|
die 'Do not know how to write'; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
26
|
|
|
|
|
46
|
return $writer; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |
36
|
|
|
|
|
|
|
__END__ |