line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
35
|
|
|
35
|
|
253
|
use strict; |
|
35
|
|
|
|
|
72
|
|
|
35
|
|
|
|
|
1131
|
|
2
|
35
|
|
|
35
|
|
193
|
use warnings; |
|
35
|
|
|
|
|
90
|
|
|
35
|
|
|
|
|
1756
|
|
3
|
|
|
|
|
|
|
package YAML::PP::Writer::File; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.036_002'; # TRIAL VERSION |
6
|
|
|
|
|
|
|
|
7
|
35
|
|
|
35
|
|
225
|
use Scalar::Util qw/ openhandle /; |
|
35
|
|
|
|
|
88
|
|
|
35
|
|
|
|
|
2065
|
|
8
|
|
|
|
|
|
|
|
9
|
35
|
|
|
35
|
|
245
|
use base qw/ YAML::PP::Writer /; |
|
35
|
|
|
|
|
88
|
|
|
35
|
|
|
|
|
4962
|
|
10
|
|
|
|
|
|
|
|
11
|
35
|
|
|
35
|
|
291
|
use Carp qw/ croak /; |
|
35
|
|
|
|
|
94
|
|
|
35
|
|
|
|
|
10502
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _open_handle { |
14
|
6
|
|
|
6
|
|
13
|
my ($self) = @_; |
15
|
6
|
100
|
|
|
|
23
|
if (openhandle($self->{output})) { |
16
|
1
|
|
|
|
|
2
|
$self->{filehandle} = $self->{output}; |
17
|
1
|
|
|
|
|
4
|
return $self->{output}; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
open my $fh, '>:encoding(UTF-8)', $self->{output} |
20
|
5
|
100
|
|
|
|
862
|
or croak "Could not open '$self->{output}' for writing: $!"; |
21
|
4
|
|
|
|
|
310
|
$self->{filehandle} = $fh; |
22
|
4
|
|
|
|
|
19
|
return $fh; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub write { |
26
|
30
|
|
|
30
|
1
|
55
|
my ($self, $line) = @_; |
27
|
30
|
|
|
|
|
50
|
my $fh = $self->{filehandle}; |
28
|
30
|
|
|
|
|
136
|
print $fh $line; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub init { |
32
|
6
|
|
|
6
|
1
|
14
|
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
|
|
|
|
18
|
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
|
|
|
|
|
511
|
close $self->{filehandle}; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |