line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package YAML::Old; |
2
|
|
|
|
|
|
|
our $VERSION = '1.23'; |
3
|
|
|
|
|
|
|
|
4
|
44
|
|
|
44
|
|
825598
|
use YAML::Old::Mo; |
|
44
|
|
|
|
|
150
|
|
|
44
|
|
|
|
|
231
|
|
5
|
|
|
|
|
|
|
|
6
|
44
|
|
|
44
|
|
234
|
use Exporter; |
|
44
|
|
|
|
|
84
|
|
|
44
|
|
|
|
|
6325
|
|
7
|
|
|
|
|
|
|
push @YAML::Old::ISA, 'Exporter'; |
8
|
|
|
|
|
|
|
our @EXPORT = qw{ Dump Load }; |
9
|
|
|
|
|
|
|
our @EXPORT_OK = qw{ freeze thaw DumpFile LoadFile Bless Blessed }; |
10
|
|
|
|
|
|
|
our ( |
11
|
|
|
|
|
|
|
$UseCode, $DumpCode, $LoadCode, |
12
|
|
|
|
|
|
|
$SpecVersion, |
13
|
|
|
|
|
|
|
$UseHeader, $UseVersion, $UseBlock, $UseFold, $UseAliases, |
14
|
|
|
|
|
|
|
$Indent, $SortKeys, $Preserve, |
15
|
|
|
|
|
|
|
$AnchorPrefix, $CompressSeries, $InlineSeries, $Purity, |
16
|
|
|
|
|
|
|
$Stringify, $Numify |
17
|
|
|
|
|
|
|
); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
44
|
|
|
44
|
|
13662
|
use YAML::Old::Node; # XXX This is a temp fix for Module::Build |
|
44
|
|
|
|
|
105
|
|
|
44
|
|
|
|
|
2006
|
|
21
|
44
|
|
|
44
|
|
256
|
use Scalar::Util qw/ openhandle /; |
|
44
|
|
|
|
|
96
|
|
|
44
|
|
|
|
|
3077
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# XXX This VALUE nonsense needs to go. |
24
|
44
|
|
|
44
|
|
254
|
use constant VALUE => "\x07YAML\x07VALUE\x07"; |
|
44
|
|
|
|
|
81
|
|
|
44
|
|
|
|
|
10064
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# YAML Object Properties |
27
|
|
|
|
|
|
|
has dumper_class => default => sub {'YAML::Old::Dumper'}; |
28
|
|
|
|
|
|
|
has loader_class => default => sub {'YAML::Old::Loader'}; |
29
|
|
|
|
|
|
|
has dumper_object => default => sub {$_[0]->init_action_object("dumper")}; |
30
|
|
|
|
|
|
|
has loader_object => default => sub {$_[0]->init_action_object("loader")}; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub Dump { |
33
|
149
|
|
|
149
|
1
|
202793
|
my $yaml = YAML::Old->new; |
34
|
149
|
50
|
|
|
|
501
|
$yaml->dumper_class($YAML::DumperClass) |
35
|
|
|
|
|
|
|
if $YAML::DumperClass; |
36
|
149
|
|
|
|
|
509
|
return $yaml->dumper_object->dump(@_); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub Load { |
40
|
279
|
|
|
279
|
1
|
275331
|
my $yaml = YAML::Old->new; |
41
|
279
|
50
|
|
|
|
809
|
$yaml->loader_class($YAML::LoaderClass) |
42
|
|
|
|
|
|
|
if $YAML::LoaderClass; |
43
|
279
|
|
|
|
|
810
|
return $yaml->loader_object->load(@_); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
{ |
47
|
44
|
|
|
44
|
|
276
|
no warnings 'once'; |
|
44
|
|
|
|
|
78
|
|
|
44
|
|
|
|
|
20187
|
|
48
|
|
|
|
|
|
|
# freeze/thaw is the API for Storable string serialization. Some |
49
|
|
|
|
|
|
|
# modules make use of serializing packages on if they use freeze/thaw. |
50
|
|
|
|
|
|
|
*freeze = \ &Dump; |
51
|
|
|
|
|
|
|
*thaw = \ &Load; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub DumpFile { |
55
|
5
|
|
|
5
|
1
|
6409
|
my $OUT; |
56
|
5
|
|
|
|
|
16
|
my $filename = shift; |
57
|
5
|
100
|
|
|
|
57
|
if (openhandle $filename) { |
58
|
2
|
|
|
|
|
5
|
$OUT = $filename; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
else { |
61
|
3
|
|
|
|
|
6
|
my $mode = '>'; |
62
|
3
|
50
|
|
|
|
14
|
if ($filename =~ /^\s*(>{1,2})\s*(.*)$/) { |
63
|
0
|
|
|
|
|
0
|
($mode, $filename) = ($1, $2); |
64
|
|
|
|
|
|
|
} |
65
|
3
|
100
|
|
|
|
242
|
open $OUT, $mode, $filename |
66
|
|
|
|
|
|
|
or YAML::Old::Mo::Object->die('YAML_DUMP_ERR_FILE_OUTPUT', $filename, "$!"); |
67
|
|
|
|
|
|
|
} |
68
|
4
|
|
|
|
|
30
|
binmode $OUT, ':utf8'; # if $Config{useperlio} eq 'define'; |
69
|
4
|
|
|
|
|
48
|
local $/ = "\n"; # reset special to "sane" |
70
|
4
|
|
|
|
|
41
|
print $OUT Dump(@_); |
71
|
4
|
50
|
|
|
|
40
|
unless (ref $filename eq 'GLOB') { |
72
|
|
|
|
|
|
|
close $OUT |
73
|
4
|
50
|
|
|
|
181
|
or do { |
74
|
0
|
|
|
|
|
0
|
my $errsav = $!; |
75
|
0
|
|
|
|
|
0
|
YAML::Old::Mo::Object->die('YAML_DUMP_ERR_FILE_OUTPUT_CLOSE', $filename, $errsav); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub LoadFile { |
81
|
5
|
|
|
5
|
1
|
4475
|
my $IN; |
82
|
5
|
|
|
|
|
16
|
my $filename = shift; |
83
|
5
|
100
|
|
|
|
51
|
if (openhandle $filename) { |
84
|
2
|
|
|
|
|
5
|
$IN = $filename; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
else { |
87
|
3
|
100
|
|
|
|
85
|
open $IN, '<', $filename |
88
|
|
|
|
|
|
|
or YAML::Old::Mo::Object->die('YAML_LOAD_ERR_FILE_INPUT', $filename, "$!"); |
89
|
|
|
|
|
|
|
} |
90
|
4
|
|
|
|
|
21
|
binmode $IN, ':utf8'; # if $Config{useperlio} eq 'define'; |
91
|
4
|
|
|
|
|
16
|
return Load(do { local $/; <$IN> }); |
|
4
|
|
|
|
|
28
|
|
|
4
|
|
|
|
|
12992
|
|
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub init_action_object { |
95
|
428
|
|
|
428
|
0
|
682
|
my $self = shift; |
96
|
428
|
|
|
|
|
815
|
my $object_class = (shift) . '_class'; |
97
|
428
|
|
|
|
|
1306
|
my $module_name = $self->$object_class; |
98
|
428
|
|
|
|
|
18703
|
eval "require $module_name"; |
99
|
428
|
50
|
33
|
|
|
1964
|
$self->die("Error in require $module_name - $@") |
100
|
|
|
|
|
|
|
if $@ and "$@" !~ /Can't locate/; |
101
|
428
|
|
|
|
|
1525
|
my $object = $self->$object_class->new; |
102
|
428
|
|
|
|
|
1708
|
$object->set_global_options; |
103
|
428
|
|
|
|
|
1867
|
return $object; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
my $global = {}; |
107
|
|
|
|
|
|
|
sub Bless { |
108
|
4
|
|
|
4
|
1
|
4906
|
require YAML::Old::Dumper::Base; |
109
|
4
|
|
|
|
|
16
|
YAML::Old::Dumper::Base::bless($global, @_) |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
sub Blessed { |
112
|
1
|
|
|
1
|
1
|
7
|
require YAML::Old::Dumper::Base; |
113
|
1
|
|
|
|
|
6
|
YAML::Old::Dumper::Base::blessed($global, @_) |
114
|
|
|
|
|
|
|
} |
115
|
502
|
|
|
502
|
0
|
1391
|
sub global_object { $global } |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |