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