line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MouseX::YAML; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
172049
|
use 5.008_001; |
|
5
|
|
|
|
|
22
|
|
|
5
|
|
|
|
|
210
|
|
4
|
5
|
|
|
5
|
|
6107
|
use Mouse::Util; # turns on strict and warnings |
|
5
|
|
|
|
|
79431
|
|
|
5
|
|
|
|
|
30
|
|
5
|
5
|
|
|
5
|
|
303
|
use Mouse::Exporter; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
43
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Mouse::Exporter->setup_import_methods( |
10
|
|
|
|
|
|
|
as_is => [qw(Load LoadFile)], |
11
|
|
|
|
|
|
|
groups => { |
12
|
|
|
|
|
|
|
default => [], |
13
|
|
|
|
|
|
|
}, |
14
|
|
|
|
|
|
|
); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub _is_object_with_meta; |
17
|
|
|
|
|
|
|
Mouse::Util::generate_can_predicate_for(['meta'], '_is_object_with_meta'); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
our @Modules; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
if(!@Modules){ |
22
|
|
|
|
|
|
|
@Modules = qw( |
23
|
|
|
|
|
|
|
YAML::XS |
24
|
|
|
|
|
|
|
YAML::Syck |
25
|
|
|
|
|
|
|
YAML |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
my $YAML = Mouse::Util::load_first_existing_class(@Modules); |
30
|
4
|
|
|
4
|
1
|
12803
|
sub backend(){ $YAML } |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
{ |
33
|
|
|
|
|
|
|
package # hide from PAUSE |
34
|
|
|
|
|
|
|
MouseX::YAML::Backend; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
$YAML->import(qw(Load LoadFile)); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub Load { |
40
|
6
|
|
|
6
|
1
|
61994
|
__PACKAGE__->load(@_); |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
sub LoadFile { |
43
|
3
|
|
|
3
|
1
|
4948
|
__PACKAGE__->load_file(@_); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub load { |
47
|
6
|
|
|
6
|
1
|
16
|
my($class, $yaml) = @_; |
48
|
|
|
|
|
|
|
|
49
|
6
|
|
|
|
|
313
|
return $class->_fixup(MouseX::YAML::Backend::Load($yaml)); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub load_file { |
53
|
3
|
|
|
3
|
1
|
9
|
my($class, $file) = @_; |
54
|
3
|
|
|
|
|
20
|
return $class->_fixup(MouseX::YAML::Backend::LoadFile($file)); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _fixup { |
58
|
15
|
|
|
15
|
|
86286
|
my($class, $proto) = @_; |
59
|
|
|
|
|
|
|
|
60
|
15
|
|
|
|
|
21
|
my $args = { %{$proto} }; |
|
15
|
|
|
|
|
98
|
|
61
|
|
|
|
|
|
|
|
62
|
15
|
|
|
|
|
30
|
%{$proto} = (); |
|
15
|
|
|
|
|
36
|
|
63
|
|
|
|
|
|
|
|
64
|
15
|
|
|
|
|
20
|
foreach my $value(values %{$args}){ |
|
15
|
|
|
|
|
43
|
|
65
|
15
|
100
|
|
|
|
192
|
if(_is_object_with_meta($value)){ |
66
|
6
|
|
|
|
|
26
|
$class->_fixup($value); |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
15
|
|
|
|
|
63
|
$proto->meta->_initialize_object($proto, $args); |
71
|
15
|
|
|
|
|
802
|
$proto->BUILDALL($args); |
72
|
15
|
|
|
|
|
99
|
return $proto; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |
76
|
|
|
|
|
|
|
__END__ |