line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
50
|
|
|
50
|
|
259370
|
use strict; use warnings; |
|
50
|
|
|
50
|
|
135
|
|
|
50
|
|
|
|
|
1290
|
|
|
50
|
|
|
|
|
251
|
|
|
50
|
|
|
|
|
88
|
|
|
50
|
|
|
|
|
3549
|
|
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package YAML::Safe; |
4
|
|
|
|
|
|
|
our $VERSION = '0.80'; |
5
|
|
|
|
|
|
|
our $XS_VERSION = $VERSION; |
6
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
7
|
|
|
|
|
|
|
|
8
|
50
|
|
|
50
|
|
355
|
use base 'Exporter'; |
|
50
|
|
|
|
|
100
|
|
|
50
|
|
|
|
|
1036
|
|
9
|
|
|
|
|
|
|
@YAML::Safe::EXPORT = qw(Load Dump); |
10
|
|
|
|
|
|
|
@YAML::Safe::EXPORT_OK = qw(LoadFile DumpFile); |
11
|
|
|
|
|
|
|
%YAML::Safe::EXPORT_TAGS = ( |
12
|
|
|
|
|
|
|
all => [qw(Dump Load LoadFile DumpFile)], |
13
|
|
|
|
|
|
|
); |
14
|
|
|
|
|
|
|
|
15
|
50
|
|
|
50
|
|
382
|
use XSLoader; |
|
50
|
|
|
|
|
99
|
|
|
50
|
|
|
|
|
32694
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# XXX The following code should be moved from Perl to C. |
18
|
|
|
|
|
|
|
$YAML::Safe::coderef2text = sub { |
19
|
|
|
|
|
|
|
my $coderef = shift; |
20
|
|
|
|
|
|
|
require B::Deparse; |
21
|
|
|
|
|
|
|
my $deparse = B::Deparse->new(); |
22
|
|
|
|
|
|
|
my $text; |
23
|
|
|
|
|
|
|
eval { |
24
|
|
|
|
|
|
|
local $^W = 0; |
25
|
|
|
|
|
|
|
$text = $deparse->coderef2text($coderef); |
26
|
|
|
|
|
|
|
}; |
27
|
|
|
|
|
|
|
if ($@) { |
28
|
|
|
|
|
|
|
warn "YAML::Safe failed to dump code ref:\n$@"; |
29
|
|
|
|
|
|
|
return; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
$text =~ s[BEGIN \{\$\{\^WARNING_BITS\} = "UUUUUUUUUUUU\\001"\}] |
32
|
|
|
|
|
|
|
[use warnings;]g; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
return $text; |
35
|
|
|
|
|
|
|
}; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$YAML::Safe::glob2hash = sub { |
38
|
|
|
|
|
|
|
my $hash = {}; |
39
|
|
|
|
|
|
|
for my $type (qw(PACKAGE NAME SCALAR ARRAY HASH CODE IO)) { |
40
|
|
|
|
|
|
|
my $value = *{$_[0]}{$type}; |
41
|
|
|
|
|
|
|
$value = $$value if $type eq 'SCALAR'; |
42
|
|
|
|
|
|
|
if (defined $value) { |
43
|
|
|
|
|
|
|
if ($type eq 'IO') { |
44
|
|
|
|
|
|
|
my @stats = qw(device inode mode links uid gid rdev size |
45
|
|
|
|
|
|
|
atime mtime ctime blksize blocks); |
46
|
|
|
|
|
|
|
undef $value; |
47
|
|
|
|
|
|
|
$value->{stat} = {}; |
48
|
|
|
|
|
|
|
map {$value->{stat}{shift @stats} = $_} stat(*{$_[0]}); |
49
|
|
|
|
|
|
|
$value->{fileno} = fileno(*{$_[0]}); |
50
|
|
|
|
|
|
|
{ |
51
|
|
|
|
|
|
|
local $^W; |
52
|
|
|
|
|
|
|
$value->{tell} = tell(*{$_[0]}); |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
$hash->{$type} = $value; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
return $hash; |
59
|
|
|
|
|
|
|
}; |
60
|
|
|
|
|
|
|
|
61
|
5
|
|
|
|
|
63
|
use constant _QR_MAP => { |
62
|
0
|
|
|
|
|
0
|
'' => sub { qr{$_[0]} }, |
63
|
0
|
|
|
|
|
0
|
x => sub { qr{$_[0]}x }, |
64
|
0
|
|
|
|
|
0
|
i => sub { qr{$_[0]}i }, |
65
|
0
|
|
|
|
|
0
|
s => sub { qr{$_[0]}s }, |
66
|
0
|
|
|
|
|
0
|
m => sub { qr{$_[0]}m }, |
67
|
0
|
|
|
|
|
0
|
ix => sub { qr{$_[0]}ix }, |
68
|
0
|
|
|
|
|
0
|
sx => sub { qr{$_[0]}sx }, |
69
|
0
|
|
|
|
|
0
|
mx => sub { qr{$_[0]}mx }, |
70
|
1
|
|
|
|
|
13
|
si => sub { qr{$_[0]}si }, |
71
|
0
|
|
|
|
|
0
|
mi => sub { qr{$_[0]}mi }, |
72
|
0
|
|
|
|
|
0
|
ms => sub { qr{$_[0]}sm }, |
73
|
0
|
|
|
|
|
0
|
six => sub { qr{$_[0]}six }, |
74
|
0
|
|
|
|
|
0
|
mix => sub { qr{$_[0]}mix }, |
75
|
0
|
|
|
|
|
0
|
msx => sub { qr{$_[0]}msx }, |
76
|
2
|
|
|
|
|
51
|
msi => sub { qr{$_[0]}msi }, |
77
|
50
|
|
|
50
|
|
387
|
msix => sub { qr{$_[0]}msix }, |
|
50
|
|
|
|
|
96
|
|
|
50
|
|
|
|
|
17585
|
|
78
|
|
|
|
|
|
|
}; |
79
|
|
|
|
|
|
|
|
80
|
11
|
100
|
|
11
|
|
12983
|
sub __qr_loader { |
81
|
8
|
|
|
|
|
36
|
if ($_[0] =~ /\A \(\? ([\^uixsm]*) (?:- (?:[ixsm]*))? : (.*) \) \z/x) { |
82
|
8
|
|
|
|
|
31
|
my ($flags, $re) = ($1, $2); |
83
|
8
|
|
|
|
|
24
|
$flags =~ s/^\^//; |
84
|
8
|
|
33
|
|
|
46
|
$flags =~ tr/u//d; |
85
|
8
|
|
|
|
|
25
|
my $sub = _QR_MAP->{$flags} || _QR_MAP->{''}; |
86
|
8
|
|
|
|
|
27326
|
my $qr = &$sub($re); |
87
|
|
|
|
|
|
|
return $qr; |
88
|
3
|
|
|
|
|
82
|
} |
89
|
|
|
|
|
|
|
return qr/$_[0]/; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
5
|
|
|
5
|
|
553
|
sub __code_loader { |
93
|
5
|
|
|
2
|
|
341
|
my ($string) = @_; |
|
2
|
|
|
1
|
|
622
|
|
|
2
|
|
|
|
|
18
|
|
|
2
|
|
|
|
|
61
|
|
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
94
|
5
|
50
|
|
|
|
20
|
my $sub = eval "sub $string"; |
95
|
0
|
|
|
|
|
0
|
if ($@) { |
96
|
0
|
|
|
0
|
|
0
|
warn "YAML::Safe failed to load sub: $@"; |
97
|
|
|
|
|
|
|
return sub {}; |
98
|
5
|
|
|
|
|
104
|
} |
99
|
|
|
|
|
|
|
return $sub; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
XSLoader::load 'YAML::Safe', $XS_VERSION; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |
105
|
|
|
|
|
|
|
__END__ |