line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package YAML::Dumper::Base; |
2
|
|
|
|
|
|
|
|
3
|
34
|
|
|
34
|
|
214
|
use YAML::Mo; |
|
34
|
|
|
|
|
70
|
|
|
34
|
|
|
|
|
195
|
|
4
|
|
|
|
|
|
|
|
5
|
34
|
|
|
34
|
|
908
|
use YAML::Node; |
|
34
|
|
|
|
|
657
|
|
|
34
|
|
|
|
|
28322
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# YAML Dumping options |
8
|
|
|
|
|
|
|
has spec_version => default => sub {'1.0'}; |
9
|
|
|
|
|
|
|
has indent_width => default => sub {2}; |
10
|
|
|
|
|
|
|
has use_header => default => sub {1}; |
11
|
|
|
|
|
|
|
has use_version => default => sub {0}; |
12
|
|
|
|
|
|
|
has sort_keys => default => sub {1}; |
13
|
|
|
|
|
|
|
has anchor_prefix => default => sub {''}; |
14
|
|
|
|
|
|
|
has dump_code => default => sub {0}; |
15
|
|
|
|
|
|
|
has use_block => default => sub {0}; |
16
|
|
|
|
|
|
|
has use_fold => default => sub {0}; |
17
|
|
|
|
|
|
|
has compress_series => default => sub {1}; |
18
|
|
|
|
|
|
|
has inline_series => default => sub {0}; |
19
|
|
|
|
|
|
|
has use_aliases => default => sub {1}; |
20
|
|
|
|
|
|
|
has purity => default => sub {0}; |
21
|
|
|
|
|
|
|
has stringify => default => sub {0}; |
22
|
|
|
|
|
|
|
has quote_numeric_strings => default => sub {0}; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Properties |
25
|
|
|
|
|
|
|
has stream => default => sub {''}; |
26
|
|
|
|
|
|
|
has document => default => sub {0}; |
27
|
|
|
|
|
|
|
has transferred => default => sub {{}}; |
28
|
|
|
|
|
|
|
has id_refcnt => default => sub {{}}; |
29
|
|
|
|
|
|
|
has id_anchor => default => sub {{}}; |
30
|
|
|
|
|
|
|
has anchor => default => sub {1}; |
31
|
|
|
|
|
|
|
has level => default => sub {0}; |
32
|
|
|
|
|
|
|
has offset => default => sub {[]}; |
33
|
|
|
|
|
|
|
has headless => default => sub {0}; |
34
|
|
|
|
|
|
|
has blessed_map => default => sub {{}}; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Global Options are an idea taken from Data::Dumper. Really they are just |
37
|
|
|
|
|
|
|
# sugar on top of real OO properties. They make the simple Dump/Load API |
38
|
|
|
|
|
|
|
# easy to configure. |
39
|
|
|
|
|
|
|
sub set_global_options { |
40
|
158
|
|
|
158
|
0
|
268
|
my $self = shift; |
41
|
158
|
50
|
|
|
|
434
|
$self->spec_version($YAML::SpecVersion) |
42
|
|
|
|
|
|
|
if defined $YAML::SpecVersion; |
43
|
158
|
100
|
|
|
|
437
|
$self->indent_width($YAML::Indent) |
44
|
|
|
|
|
|
|
if defined $YAML::Indent; |
45
|
158
|
100
|
|
|
|
361
|
$self->use_header($YAML::UseHeader) |
46
|
|
|
|
|
|
|
if defined $YAML::UseHeader; |
47
|
158
|
50
|
|
|
|
332
|
$self->use_version($YAML::UseVersion) |
48
|
|
|
|
|
|
|
if defined $YAML::UseVersion; |
49
|
158
|
100
|
|
|
|
327
|
$self->sort_keys($YAML::SortKeys) |
50
|
|
|
|
|
|
|
if defined $YAML::SortKeys; |
51
|
158
|
50
|
|
|
|
335
|
$self->anchor_prefix($YAML::AnchorPrefix) |
52
|
|
|
|
|
|
|
if defined $YAML::AnchorPrefix; |
53
|
158
|
100
|
100
|
|
|
850
|
$self->dump_code($YAML::DumpCode || $YAML::UseCode) |
|
|
|
100
|
|
|
|
|
54
|
|
|
|
|
|
|
if defined $YAML::DumpCode or defined $YAML::UseCode; |
55
|
158
|
100
|
|
|
|
389
|
$self->use_block($YAML::UseBlock) |
56
|
|
|
|
|
|
|
if defined $YAML::UseBlock; |
57
|
158
|
50
|
|
|
|
344
|
$self->use_fold($YAML::UseFold) |
58
|
|
|
|
|
|
|
if defined $YAML::UseFold; |
59
|
158
|
100
|
|
|
|
329
|
$self->compress_series($YAML::CompressSeries) |
60
|
|
|
|
|
|
|
if defined $YAML::CompressSeries; |
61
|
158
|
100
|
|
|
|
335
|
$self->inline_series($YAML::InlineSeries) |
62
|
|
|
|
|
|
|
if defined $YAML::InlineSeries; |
63
|
158
|
100
|
|
|
|
316
|
$self->use_aliases($YAML::UseAliases) |
64
|
|
|
|
|
|
|
if defined $YAML::UseAliases; |
65
|
158
|
50
|
|
|
|
403
|
$self->purity($YAML::Purity) |
66
|
|
|
|
|
|
|
if defined $YAML::Purity; |
67
|
158
|
100
|
|
|
|
321
|
$self->stringify($YAML::Stringify) |
68
|
|
|
|
|
|
|
if defined $YAML::Stringify; |
69
|
158
|
100
|
|
|
|
411
|
$self->quote_numeric_strings($YAML::QuoteNumericStrings) |
70
|
|
|
|
|
|
|
if defined $YAML::QuoteNumericStrings; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub dump { |
74
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
75
|
0
|
|
|
|
|
0
|
$self->die('dump() not implemented in this class.'); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub blessed { |
79
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
80
|
1
|
|
|
|
|
3
|
my ($ref) = @_; |
81
|
1
|
50
|
|
|
|
5
|
$ref = \$_[0] unless ref $ref; |
82
|
1
|
|
|
|
|
4
|
my (undef, undef, $node_id) = YAML::Mo::Object->node_info($ref); |
83
|
1
|
|
|
|
|
17
|
$self->{blessed_map}->{$node_id}; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub bless { |
87
|
4
|
|
|
4
|
0
|
8
|
my $self = shift; |
88
|
4
|
|
|
|
|
12
|
my ($ref, $blessing) = @_; |
89
|
4
|
|
|
|
|
5
|
my $ynode; |
90
|
4
|
50
|
|
|
|
15
|
$ref = \$_[0] unless ref $ref; |
91
|
4
|
|
|
|
|
31
|
my (undef, undef, $node_id) = YAML::Mo::Object->node_info($ref); |
92
|
4
|
100
|
|
|
|
17
|
if (not defined $blessing) { |
|
|
100
|
|
|
|
|
|
93
|
2
|
|
|
|
|
11
|
$ynode = YAML::Node->new($ref); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
elsif (ref $blessing) { |
96
|
1
|
50
|
|
|
|
5
|
$self->die() unless ynode($blessing); |
97
|
1
|
|
|
|
|
4
|
$ynode = $blessing; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
else { |
100
|
34
|
|
|
34
|
|
256
|
no strict 'refs'; |
|
34
|
|
|
|
|
71
|
|
|
34
|
|
|
|
|
5244
|
|
101
|
1
|
|
|
|
|
4
|
my $transfer = $blessing . "::yaml_dump"; |
102
|
1
|
50
|
|
|
|
3
|
$self->die() unless defined &{$transfer}; |
|
1
|
|
|
|
|
7
|
|
103
|
1
|
|
|
|
|
2
|
$ynode = &{$transfer}($ref); |
|
1
|
|
|
|
|
22
|
|
104
|
1
|
50
|
|
|
|
8
|
$self->die() unless ynode($ynode); |
105
|
|
|
|
|
|
|
} |
106
|
4
|
|
|
|
|
13
|
$self->{blessed_map}->{$node_id} = $ynode; |
107
|
4
|
50
|
|
|
|
10
|
my $object = ynode($ynode) or $self->die(); |
108
|
4
|
|
|
|
|
56
|
return $object; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
1; |