line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
45
|
|
|
45
|
|
323794
|
use strict; use warnings; |
|
45
|
|
|
45
|
|
146
|
|
|
45
|
|
|
|
|
1241
|
|
|
45
|
|
|
|
|
256
|
|
|
45
|
|
|
|
|
108
|
|
|
45
|
|
|
|
|
2493
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package YAML::XS; |
4
|
|
|
|
|
|
|
our $VERSION = '0.87'; |
5
|
|
|
|
|
|
|
|
6
|
45
|
|
|
45
|
|
321
|
use base 'Exporter'; |
|
45
|
|
|
|
|
117
|
|
|
45
|
|
|
|
|
1776
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
@YAML::XS::EXPORT = qw(Load Dump); |
9
|
|
|
|
|
|
|
@YAML::XS::EXPORT_OK = qw(LoadFile DumpFile); |
10
|
|
|
|
|
|
|
%YAML::XS::EXPORT_TAGS = ( |
11
|
|
|
|
|
|
|
all => [qw(Dump Load LoadFile DumpFile)], |
12
|
|
|
|
|
|
|
); |
13
|
|
|
|
|
|
|
our ( |
14
|
|
|
|
|
|
|
$Boolean, |
15
|
|
|
|
|
|
|
$DumpCode, |
16
|
|
|
|
|
|
|
$ForbidDuplicateKeys, |
17
|
|
|
|
|
|
|
$Indent, |
18
|
|
|
|
|
|
|
$LoadBlessed, |
19
|
|
|
|
|
|
|
$LoadCode, |
20
|
|
|
|
|
|
|
$UseCode, |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
$ForbidDuplicateKeys = 0; |
23
|
|
|
|
|
|
|
# $YAML::XS::UseCode = 0; |
24
|
|
|
|
|
|
|
# $YAML::XS::DumpCode = 0; |
25
|
|
|
|
|
|
|
# $YAML::XS::LoadCode = 0; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$YAML::XS::QuoteNumericStrings = 1; |
28
|
|
|
|
|
|
|
|
29
|
45
|
|
|
45
|
|
18386
|
use YAML::XS::LibYAML qw(Load Dump); |
|
45
|
|
|
|
|
170
|
|
|
45
|
|
|
|
|
3948
|
|
30
|
45
|
|
|
45
|
|
340
|
use Scalar::Util qw/ openhandle /; |
|
45
|
|
|
|
|
98
|
|
|
45
|
|
|
|
|
47186
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub DumpFile { |
33
|
4
|
|
|
4
|
0
|
6922
|
my $OUT; |
34
|
4
|
|
|
|
|
30
|
my $filename = shift; |
35
|
4
|
100
|
|
|
|
380
|
if (openhandle $filename) { |
36
|
2
|
|
|
|
|
12
|
$OUT = $filename; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
else { |
39
|
2
|
|
|
|
|
6
|
my $mode = '>'; |
40
|
2
|
50
|
|
|
|
9
|
if ($filename =~ /^\s*(>{1,2})\s*(.*)$/) { |
41
|
0
|
|
|
|
|
0
|
($mode, $filename) = ($1, $2); |
42
|
|
|
|
|
|
|
} |
43
|
2
|
50
|
|
|
|
174
|
open $OUT, $mode, $filename |
44
|
|
|
|
|
|
|
or die "Can't open '$filename' for output:\n$!"; |
45
|
|
|
|
|
|
|
} |
46
|
4
|
|
|
|
|
38
|
local $/ = "\n"; # reset special to "sane" |
47
|
4
|
|
|
|
|
887
|
print $OUT YAML::XS::LibYAML::Dump(@_); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
sub LoadFile { |
51
|
5
|
|
|
5
|
0
|
3247
|
my $IN; |
52
|
5
|
|
|
|
|
27
|
my $filename = shift; |
53
|
5
|
100
|
|
|
|
348
|
if (openhandle $filename) { |
54
|
2
|
|
|
|
|
15
|
$IN = $filename; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
else { |
57
|
3
|
50
|
|
|
|
122
|
open $IN, $filename |
58
|
|
|
|
|
|
|
or die "Can't open '$filename' for input:\n$!"; |
59
|
|
|
|
|
|
|
} |
60
|
5
|
|
|
|
|
23
|
return YAML::XS::LibYAML::Load(do { local $/; local $_ = <$IN> }); |
|
5
|
|
|
|
|
49
|
|
|
5
|
|
|
|
|
1174
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# XXX The following code should be moved from Perl to C. |
65
|
|
|
|
|
|
|
$YAML::XS::coderef2text = sub { |
66
|
|
|
|
|
|
|
my $coderef = shift; |
67
|
|
|
|
|
|
|
require B::Deparse; |
68
|
|
|
|
|
|
|
my $deparse = B::Deparse->new(); |
69
|
|
|
|
|
|
|
my $text; |
70
|
|
|
|
|
|
|
eval { |
71
|
|
|
|
|
|
|
local $^W = 0; |
72
|
|
|
|
|
|
|
$text = $deparse->coderef2text($coderef); |
73
|
|
|
|
|
|
|
}; |
74
|
|
|
|
|
|
|
if ($@) { |
75
|
|
|
|
|
|
|
warn "YAML::XS failed to dump code ref:\n$@"; |
76
|
|
|
|
|
|
|
return; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
$text =~ s[BEGIN \{\$\{\^WARNING_BITS\} = "UUUUUUUUUUUU\\001"\}] |
79
|
|
|
|
|
|
|
[use warnings;]g; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
return $text; |
82
|
|
|
|
|
|
|
}; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
$YAML::XS::glob2hash = sub { |
85
|
|
|
|
|
|
|
my $hash = {}; |
86
|
|
|
|
|
|
|
for my $type (qw(PACKAGE NAME SCALAR ARRAY HASH CODE IO)) { |
87
|
|
|
|
|
|
|
my $value = *{$_[0]}{$type}; |
88
|
|
|
|
|
|
|
$value = $$value if $type eq 'SCALAR'; |
89
|
|
|
|
|
|
|
if (defined $value) { |
90
|
|
|
|
|
|
|
if ($type eq 'IO') { |
91
|
|
|
|
|
|
|
my @stats = qw(device inode mode links uid gid rdev size |
92
|
|
|
|
|
|
|
atime mtime ctime blksize blocks); |
93
|
|
|
|
|
|
|
undef $value; |
94
|
|
|
|
|
|
|
$value->{stat} = {}; |
95
|
|
|
|
|
|
|
map {$value->{stat}{shift @stats} = $_} stat(*{$_[0]}); |
96
|
|
|
|
|
|
|
$value->{fileno} = fileno(*{$_[0]}); |
97
|
|
|
|
|
|
|
{ |
98
|
|
|
|
|
|
|
local $^W; |
99
|
|
|
|
|
|
|
$value->{tell} = tell(*{$_[0]}); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
$hash->{$type} = $value; |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
return $hash; |
106
|
|
|
|
|
|
|
}; |
107
|
|
|
|
|
|
|
|
108
|
5
|
|
|
|
|
64
|
use constant _QR_MAP => { |
109
|
0
|
|
|
|
|
0
|
'' => sub { qr{$_[0]} }, |
110
|
0
|
|
|
|
|
0
|
x => sub { qr{$_[0]}x }, |
111
|
0
|
|
|
|
|
0
|
i => sub { qr{$_[0]}i }, |
112
|
0
|
|
|
|
|
0
|
s => sub { qr{$_[0]}s }, |
113
|
0
|
|
|
|
|
0
|
m => sub { qr{$_[0]}m }, |
114
|
0
|
|
|
|
|
0
|
ix => sub { qr{$_[0]}ix }, |
115
|
0
|
|
|
|
|
0
|
sx => sub { qr{$_[0]}sx }, |
116
|
0
|
|
|
|
|
0
|
mx => sub { qr{$_[0]}mx }, |
117
|
1
|
|
|
|
|
15
|
si => sub { qr{$_[0]}si }, |
118
|
0
|
|
|
|
|
0
|
mi => sub { qr{$_[0]}mi }, |
119
|
0
|
|
|
|
|
0
|
ms => sub { qr{$_[0]}sm }, |
120
|
0
|
|
|
|
|
0
|
six => sub { qr{$_[0]}six }, |
121
|
0
|
|
|
|
|
0
|
mix => sub { qr{$_[0]}mix }, |
122
|
0
|
|
|
|
|
0
|
msx => sub { qr{$_[0]}msx }, |
123
|
2
|
|
|
|
|
49
|
msi => sub { qr{$_[0]}msi }, |
124
|
45
|
|
|
45
|
|
372
|
msix => sub { qr{$_[0]}msix }, |
|
45
|
|
|
|
|
116
|
|
|
45
|
|
|
|
|
17358
|
|
125
|
|
|
|
|
|
|
}; |
126
|
|
|
|
|
|
|
|
127
|
11
|
100
|
|
11
|
|
16476
|
sub __qr_loader { |
128
|
8
|
|
|
|
|
35
|
if ($_[0] =~ /\A \(\? ([\^uixsm]*) (?:- (?:[ixsm]*))? : (.*) \) \z/x) { |
129
|
8
|
|
|
|
|
33
|
my ($flags, $re) = ($1, $2); |
130
|
8
|
|
|
|
|
30
|
$flags =~ s/^\^//; |
131
|
8
|
|
33
|
|
|
38
|
$flags =~ tr/u//d; |
132
|
8
|
|
|
|
|
23
|
my $sub = _QR_MAP->{$flags} || _QR_MAP->{''}; |
133
|
8
|
|
|
|
|
28168
|
my $qr = &$sub($re); |
134
|
|
|
|
|
|
|
return $qr; |
135
|
3
|
|
|
|
|
110
|
} |
136
|
|
|
|
|
|
|
return qr/$_[0]/; |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
2
|
|
|
2
|
|
1048
|
sub __code_loader { |
140
|
2
|
|
|
2
|
|
136
|
my ($string) = @_; |
|
2
|
|
|
1
|
|
664
|
|
|
2
|
|
|
|
|
17
|
|
|
2
|
|
|
|
|
71
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
141
|
2
|
50
|
|
|
|
8
|
my $sub = eval "sub $string"; |
142
|
0
|
|
|
|
|
0
|
if ($@) { |
143
|
0
|
|
|
0
|
|
0
|
warn "YAML::XS failed to load sub: $@"; |
144
|
|
|
|
|
|
|
return sub {}; |
145
|
2
|
|
|
|
|
29
|
} |
146
|
|
|
|
|
|
|
return $sub; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
1; |