| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
44
|
|
|
44
|
|
142881
|
use strict; |
|
|
44
|
|
|
|
|
62
|
|
|
|
44
|
|
|
|
|
1405
|
|
|
2
|
44
|
|
|
44
|
|
145
|
use warnings; |
|
|
44
|
|
|
|
|
72
|
|
|
|
44
|
|
|
|
|
2948
|
|
|
3
|
|
|
|
|
|
|
package YAML::PP::Writer::File; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = 'v0.40.0'; # VERSION |
|
6
|
|
|
|
|
|
|
|
|
7
|
44
|
|
|
44
|
|
218
|
use Scalar::Util qw/ openhandle /; |
|
|
44
|
|
|
|
|
63
|
|
|
|
44
|
|
|
|
|
2339
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
44
|
|
|
44
|
|
231
|
use base qw/ YAML::PP::Writer /; |
|
|
44
|
|
|
|
|
59
|
|
|
|
44
|
|
|
|
|
5371
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
44
|
|
|
44
|
|
293
|
use Carp qw/ croak /; |
|
|
44
|
|
|
|
|
120
|
|
|
|
44
|
|
|
|
|
11578
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub _open_handle { |
|
14
|
6
|
|
|
6
|
|
11
|
my ($self) = @_; |
|
15
|
6
|
100
|
|
|
|
25
|
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
|
|
|
|
1241
|
or croak "Could not open '$self->{output}' for writing: $!"; |
|
21
|
4
|
|
|
|
|
323
|
$self->{filehandle} = $fh; |
|
22
|
4
|
|
|
|
|
14
|
return $fh; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub write { |
|
26
|
30
|
|
|
30
|
1
|
75
|
my ($self, $line) = @_; |
|
27
|
30
|
|
|
|
|
39
|
my $fh = $self->{filehandle}; |
|
28
|
30
|
|
|
|
|
150
|
print $fh $line; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub init { |
|
32
|
6
|
|
|
6
|
1
|
11
|
my ($self) = @_; |
|
33
|
6
|
|
|
|
|
15
|
my $fh = $self->_open_handle; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub finish { |
|
37
|
5
|
|
|
5
|
1
|
34
|
my ($self) = @_; |
|
38
|
5
|
100
|
|
|
|
33
|
if (openhandle($self->{output})) { |
|
39
|
|
|
|
|
|
|
# Original argument was a file handle, so the caller needs |
|
40
|
|
|
|
|
|
|
# to close it |
|
41
|
1
|
|
|
|
|
2
|
return; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
4
|
|
|
|
|
465
|
close $self->{filehandle}; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
__END__ |