line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
35
|
|
|
35
|
|
242
|
use strict; |
|
35
|
|
|
|
|
79
|
|
|
35
|
|
|
|
|
1010
|
|
2
|
35
|
|
|
35
|
|
188
|
use warnings; |
|
35
|
|
|
|
|
96
|
|
|
35
|
|
|
|
|
1765
|
|
3
|
|
|
|
|
|
|
package YAML::PP::Writer::File; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.036_001'; # TRIAL VERSION |
6
|
|
|
|
|
|
|
|
7
|
35
|
|
|
35
|
|
206
|
use Scalar::Util qw/ openhandle /; |
|
35
|
|
|
|
|
93
|
|
|
35
|
|
|
|
|
1925
|
|
8
|
|
|
|
|
|
|
|
9
|
35
|
|
|
35
|
|
237
|
use base qw/ YAML::PP::Writer /; |
|
35
|
|
|
|
|
82
|
|
|
35
|
|
|
|
|
4786
|
|
10
|
|
|
|
|
|
|
|
11
|
35
|
|
|
35
|
|
287
|
use Carp qw/ croak /; |
|
35
|
|
|
|
|
92
|
|
|
35
|
|
|
|
|
10172
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _open_handle { |
14
|
6
|
|
|
6
|
|
14
|
my ($self) = @_; |
15
|
6
|
100
|
|
|
|
22
|
if (openhandle($self->{output})) { |
16
|
1
|
|
|
|
|
3
|
$self->{filehandle} = $self->{output}; |
17
|
1
|
|
|
|
|
3
|
return $self->{output}; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
open my $fh, '>:encoding(UTF-8)', $self->{output} |
20
|
5
|
100
|
|
|
|
691
|
or croak "Could not open '$self->{output}' for writing: $!"; |
21
|
4
|
|
|
|
|
294
|
$self->{filehandle} = $fh; |
22
|
4
|
|
|
|
|
16
|
return $fh; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub write { |
26
|
30
|
|
|
30
|
1
|
60
|
my ($self, $line) = @_; |
27
|
30
|
|
|
|
|
48
|
my $fh = $self->{filehandle}; |
28
|
30
|
|
|
|
|
140
|
print $fh $line; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub init { |
32
|
6
|
|
|
6
|
1
|
17
|
my ($self) = @_; |
33
|
6
|
|
|
|
|
17
|
my $fh = $self->_open_handle; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub finish { |
37
|
5
|
|
|
5
|
1
|
14
|
my ($self) = @_; |
38
|
5
|
100
|
|
|
|
17
|
if (openhandle($self->{output})) { |
39
|
|
|
|
|
|
|
# Original argument was a file handle, so the caller needs |
40
|
|
|
|
|
|
|
# to close it |
41
|
1
|
|
|
|
|
3
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
4
|
|
|
|
|
431
|
close $self->{filehandle}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |