line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
35
|
|
|
35
|
|
1054672
|
use strict; use warnings; |
|
35
|
|
|
35
|
|
92
|
|
|
35
|
|
|
|
|
1377
|
|
|
35
|
|
|
|
|
193
|
|
|
35
|
|
|
|
|
69
|
|
|
35
|
|
|
|
|
2218
|
|
2
|
|
|
|
|
|
|
package YAML::Old; |
3
|
|
|
|
|
|
|
our $VERSION = '1.07'; |
4
|
|
|
|
|
|
|
|
5
|
35
|
|
|
35
|
|
19915
|
use YAML::Old::Mo; |
|
35
|
|
|
|
|
98
|
|
|
35
|
|
|
|
|
229
|
|
6
|
|
|
|
|
|
|
|
7
|
35
|
|
|
35
|
|
469
|
use Exporter; |
|
35
|
|
|
|
|
66
|
|
|
35
|
|
|
|
|
3532
|
|
8
|
|
|
|
|
|
|
push @YAML::Old::ISA, 'Exporter'; |
9
|
|
|
|
|
|
|
our @EXPORT = qw{ Dump Load }; |
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw{ freeze thaw DumpFile LoadFile Bless Blessed }; |
11
|
|
|
|
|
|
|
|
12
|
35
|
|
|
35
|
|
22178
|
use YAML::Old::Node; # XXX This is a temp fix for Module::Build |
|
35
|
|
|
|
|
90
|
|
|
35
|
|
|
|
|
2840
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# XXX This VALUE nonsense needs to go. |
15
|
|
|
|
|
|
|
{ |
16
|
|
|
|
|
|
|
package |
17
|
|
|
|
|
|
|
YAML; |
18
|
35
|
|
|
35
|
|
202
|
use constant VALUE => "\x07YAML\x07VALUE\x07"; |
|
35
|
|
|
|
|
64
|
|
|
35
|
|
|
|
|
11480
|
|
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# YAML Object Properties |
22
|
|
|
|
|
|
|
has dumper_class => default => sub {'YAML::Old::Dumper'}; |
23
|
|
|
|
|
|
|
has loader_class => default => sub {'YAML::Old::Loader'}; |
24
|
|
|
|
|
|
|
has dumper_object => default => sub {$_[0]->init_action_object("dumper")}; |
25
|
|
|
|
|
|
|
has loader_object => default => sub {$_[0]->init_action_object("loader")}; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub Dump { |
28
|
138
|
|
|
138
|
1
|
328434
|
my $yaml = YAML::Old->new; |
29
|
138
|
50
|
|
|
|
506
|
$yaml->dumper_class($YAML::Old::DumperClass) |
30
|
|
|
|
|
|
|
if $YAML::Old::DumperClass; |
31
|
138
|
|
|
|
|
728
|
return $yaml->dumper_object->dump(@_); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub Load { |
35
|
260
|
|
|
260
|
1
|
480577
|
my $yaml = YAML::Old->new; |
36
|
260
|
50
|
|
|
|
1062
|
$yaml->loader_class($YAML::Old::LoaderClass) |
37
|
|
|
|
|
|
|
if $YAML::Old::LoaderClass; |
38
|
260
|
|
|
|
|
1117
|
return $yaml->loader_object->load(@_); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
{ |
42
|
35
|
|
|
35
|
|
195
|
no warnings 'once'; |
|
35
|
|
|
|
|
75
|
|
|
35
|
|
|
|
|
23114
|
|
43
|
|
|
|
|
|
|
# freeze/thaw is the API for Storable string serialization. Some |
44
|
|
|
|
|
|
|
# modules make use of serializing packages on if they use freeze/thaw. |
45
|
|
|
|
|
|
|
*freeze = \ &Dump; |
46
|
|
|
|
|
|
|
*thaw = \ &Load; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub DumpFile { |
50
|
3
|
|
|
3
|
1
|
4623
|
my $OUT; |
51
|
3
|
|
|
|
|
9
|
my $filename = shift; |
52
|
3
|
50
|
|
|
|
17
|
if (ref $filename eq 'GLOB') { |
53
|
0
|
|
|
|
|
0
|
$OUT = $filename; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
else { |
56
|
3
|
|
|
|
|
8
|
my $mode = '>'; |
57
|
3
|
50
|
|
|
|
19
|
if ($filename =~ /^\s*(>{1,2})\s*(.*)$/) { |
58
|
0
|
|
|
|
|
0
|
($mode, $filename) = ($1, $2); |
59
|
|
|
|
|
|
|
} |
60
|
3
|
100
|
|
|
|
449
|
open $OUT, $mode, $filename |
61
|
|
|
|
|
|
|
or YAML::Old::Mo::Object->die('YAML_DUMP_ERR_FILE_OUTPUT', $filename, $!); |
62
|
|
|
|
|
|
|
} |
63
|
2
|
|
|
|
|
18
|
binmode $OUT, ':utf8'; # if $Config{useperlio} eq 'define'; |
64
|
2
|
|
|
|
|
13
|
local $/ = "\n"; # reset special to "sane" |
65
|
2
|
|
|
|
|
12
|
print $OUT Dump(@_); |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub LoadFile { |
69
|
3
|
|
|
3
|
1
|
3627
|
my $IN; |
70
|
3
|
|
|
|
|
9
|
my $filename = shift; |
71
|
3
|
50
|
|
|
|
15
|
if (ref $filename eq 'GLOB') { |
72
|
0
|
|
|
|
|
0
|
$IN = $filename; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
else { |
75
|
3
|
100
|
|
|
|
157
|
open $IN, '<', $filename |
76
|
|
|
|
|
|
|
or YAML::Old::Mo::Object->die('YAML_LOAD_ERR_FILE_INPUT', $filename, $!); |
77
|
|
|
|
|
|
|
} |
78
|
2
|
|
|
|
|
12
|
binmode $IN, ':utf8'; # if $Config{useperlio} eq 'define'; |
79
|
2
|
|
|
|
|
4
|
return Load(do { local $/; <$IN> }); |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
110
|
|
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub init_action_object { |
83
|
398
|
|
|
398
|
0
|
1879
|
my $self = shift; |
84
|
398
|
|
|
|
|
813
|
my $object_class = (shift) . '_class'; |
85
|
398
|
|
|
|
|
1471
|
my $module_name = $self->$object_class; |
86
|
398
|
|
|
|
|
32220
|
eval "require $module_name"; |
87
|
398
|
50
|
33
|
|
|
2737
|
$self->die("Error in require $module_name - $@") |
88
|
|
|
|
|
|
|
if $@ and "$@" !~ /Can't locate/; |
89
|
398
|
|
|
|
|
13812
|
my $object = $self->$object_class->new; |
90
|
398
|
|
|
|
|
2592
|
$object->set_global_options; |
91
|
398
|
|
|
|
|
4976
|
return $object; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
my $global = {}; |
95
|
|
|
|
|
|
|
sub Bless { |
96
|
4
|
|
|
4
|
1
|
5951
|
require YAML::Old::Dumper::Base; |
97
|
4
|
|
|
|
|
17
|
YAML::Old::Dumper::Base::bless($global, @_) |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
sub Blessed { |
100
|
1
|
|
|
1
|
1
|
8
|
require YAML::Old::Dumper::Base; |
101
|
1
|
|
|
|
|
5
|
YAML::Old::Dumper::Base::blessed($global, @_) |
102
|
|
|
|
|
|
|
} |
103
|
484
|
|
|
484
|
0
|
1806
|
sub global_object { $global } |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |