| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package YAML::Perl; |
|
2
|
12
|
|
|
12
|
|
8825
|
use 5.005003; |
|
|
12
|
|
|
|
|
62
|
|
|
|
12
|
|
|
|
|
500
|
|
|
3
|
12
|
|
|
12
|
|
62
|
use strict; |
|
|
12
|
|
|
|
|
21
|
|
|
|
12
|
|
|
|
|
378
|
|
|
4
|
12
|
|
|
12
|
|
68
|
use warnings; # XXX requires 5.6+ |
|
|
12
|
|
|
|
|
22
|
|
|
|
12
|
|
|
|
|
574
|
|
|
5
|
12
|
|
|
12
|
|
5977
|
use YAML::Perl::Base -base; |
|
|
12
|
|
|
|
|
30
|
|
|
|
12
|
|
|
|
|
118
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$YAML::Perl::VERSION = '0.02'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
@YAML::Perl::EXPORT = qw'Dump Load'; |
|
10
|
|
|
|
|
|
|
@YAML::Perl::EXPORT_OK = qw'DumpFile LoadFile freeze thaw emit'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
field dumper_class => -chain, |
|
13
|
|
|
|
|
|
|
-class => '-init', |
|
14
|
|
|
|
|
|
|
-init => '$YAML::Perl::DumperClass || $YAML::DumperClass || "YAML::Perl::Dumper"'; |
|
15
|
|
|
|
|
|
|
field dumper => |
|
16
|
|
|
|
|
|
|
-class => '-init', |
|
17
|
|
|
|
|
|
|
-init => '$self->create("dumper")'; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
field loader_class => -chain, |
|
20
|
|
|
|
|
|
|
-class => '-init', |
|
21
|
|
|
|
|
|
|
-init => '$YAML::Perl::LoaderClass || $YAML::LoaderClass || "YAML::Perl::Loader"'; |
|
22
|
|
|
|
|
|
|
field loader => |
|
23
|
|
|
|
|
|
|
-class => '-init', |
|
24
|
|
|
|
|
|
|
-init => '$self->create("loader")'; |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
field resolver_class => -chain, |
|
27
|
|
|
|
|
|
|
-class => '-init', |
|
28
|
|
|
|
|
|
|
-init => '$YAML::Perl::ResolverClass || $YAML::ResolverClass || "YAML::Perl::Resolver"'; |
|
29
|
|
|
|
|
|
|
field resolver => |
|
30
|
|
|
|
|
|
|
-class => '-init', |
|
31
|
|
|
|
|
|
|
-init => '$self->create("resolver")'; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub Dump { |
|
34
|
6
|
|
|
6
|
0
|
78
|
my $dumper = YAML::Perl->new()->dumper; |
|
35
|
6
|
|
|
|
|
54
|
$dumper->open(); |
|
36
|
6
|
|
|
|
|
31
|
$dumper->dump(@_); |
|
37
|
6
|
|
|
|
|
46
|
$dumper->close; |
|
38
|
6
|
|
|
|
|
20
|
return $dumper->stream; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub Load { |
|
42
|
0
|
|
|
0
|
0
|
0
|
my $loader = YAML::Perl->new->loader; |
|
43
|
0
|
|
|
|
|
0
|
$loader->open(@_); |
|
44
|
0
|
|
|
|
|
0
|
return ($loader->load()); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
{ |
|
48
|
12
|
|
|
12
|
|
80
|
no warnings 'once'; |
|
|
12
|
|
|
|
|
29
|
|
|
|
12
|
|
|
|
|
6077
|
|
|
49
|
|
|
|
|
|
|
*YAML::Perl::freeze = \ &Dump; |
|
50
|
|
|
|
|
|
|
*YAML::Perl::thaw = \ &Load; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub DumpFile { |
|
54
|
0
|
|
|
0
|
0
|
0
|
my $OUT; |
|
55
|
0
|
|
|
|
|
0
|
my $filename = shift; |
|
56
|
0
|
0
|
|
|
|
0
|
if (ref $filename eq 'GLOB') { |
|
57
|
0
|
|
|
|
|
0
|
$OUT = $filename; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
else { |
|
60
|
0
|
|
|
|
|
0
|
my $mode = '>'; |
|
61
|
0
|
0
|
|
|
|
0
|
if ($filename =~ /^\s*(>{1,2})\s*(.*)$/) { |
|
62
|
0
|
|
|
|
|
0
|
($mode, $filename) = ($1, $2); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
0
|
0
|
|
|
|
0
|
open $OUT, $mode, $filename |
|
65
|
|
|
|
|
|
|
or YAML::Perl::Base->die('YAML_DUMP_ERR_FILE_OUTPUT', $filename, $!); |
|
66
|
|
|
|
|
|
|
} |
|
67
|
0
|
|
|
|
|
0
|
local $/ = "\n"; # rset special to "sane" |
|
68
|
0
|
|
|
|
|
0
|
print $OUT Dump(@_); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub LoadFile { |
|
72
|
0
|
|
|
0
|
0
|
0
|
my $IN; |
|
73
|
0
|
|
|
|
|
0
|
my $filename = shift; |
|
74
|
0
|
0
|
|
|
|
0
|
if (ref $filename eq 'GLOB') { |
|
75
|
0
|
|
|
|
|
0
|
$IN = $filename; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
else { |
|
78
|
0
|
0
|
|
|
|
0
|
open $IN, $filename |
|
79
|
|
|
|
|
|
|
or YAML::Perl::Base->die('YAML_LOAD_ERR_FILE_INPUT', $filename, $!); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
0
|
|
|
|
|
0
|
return Load(do { local $/; <$IN> }); |
|
|
0
|
|
|
|
|
0
|
|
|
|
0
|
|
|
|
|
0
|
|
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
# Ported EXPORT_OK top level functions from PyYaml |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub emit { |
|
87
|
4
|
|
|
4
|
0
|
8
|
my $events = shift; |
|
88
|
4
|
|
|
|
|
1042
|
require YAML::Perl::Emitter; |
|
89
|
4
|
|
|
|
|
31
|
my $emitter = YAML::Perl::Emitter->new->open; |
|
90
|
4
|
|
|
|
|
12
|
for my $event (@$events) { |
|
91
|
20
|
|
|
|
|
65
|
$emitter->emit($event); |
|
92
|
|
|
|
|
|
|
} |
|
93
|
4
|
|
|
|
|
100
|
my $buffer = $emitter->writer->stream->buffer; |
|
94
|
4
|
|
|
|
|
30
|
$emitter->close; |
|
95
|
4
|
|
|
|
|
580
|
return $$buffer; |
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
1; |