| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Config::Any::YAML; |
|
2
|
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
974
|
use strict; |
|
|
6
|
|
|
|
|
60
|
|
|
|
6
|
|
|
|
|
97
|
|
|
4
|
6
|
|
|
6
|
|
128
|
use warnings; |
|
|
6
|
|
|
|
|
55
|
|
|
|
6
|
|
|
|
|
219
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Config::Any::YAML - Load YAML config files |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Loads YAML files. Example: |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
--- |
|
15
|
|
|
|
|
|
|
name: TestApp |
|
16
|
|
|
|
|
|
|
Controller::Foo: |
|
17
|
|
|
|
|
|
|
foo: bar |
|
18
|
|
|
|
|
|
|
Model::Baz: |
|
19
|
|
|
|
|
|
|
qux: xyzzy |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 METHODS |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head2 extensions( ) |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return an array of valid extensions (C<yml>, C<yaml>). |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub extensions { |
|
31
|
7
|
|
|
7
|
1
|
93
|
return qw( yml yaml ); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 load( $file ) |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Attempts to load C<$file> as a YAML file. |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=cut |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub load { |
|
41
|
6
|
|
|
6
|
1
|
94
|
my $class = shift; |
|
42
|
6
|
|
|
|
|
57
|
my $file = shift; |
|
43
|
|
|
|
|
|
|
|
|
44
|
6
|
|
|
|
|
55
|
eval { require YAML::Syck; }; |
|
|
6
|
|
|
|
|
246
|
|
|
45
|
6
|
50
|
|
|
|
91
|
if( $@ ) { |
|
46
|
0
|
|
|
|
|
0
|
require YAML; |
|
47
|
0
|
|
|
|
|
0
|
return YAML::LoadFile( $file ); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
else { |
|
50
|
6
|
50
|
|
|
|
518
|
open( my $fh, $file ) or die $!; |
|
51
|
6
|
|
|
|
|
63
|
my $content = do { local $/; <$fh> }; |
|
|
6
|
|
|
|
|
73
|
|
|
|
6
|
|
|
|
|
8407
|
|
|
52
|
6
|
|
|
|
|
2132
|
close $fh; |
|
53
|
6
|
|
|
|
|
433
|
return YAML::Syck::Load( $content ); |
|
54
|
|
|
|
|
|
|
} |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 AUTHOR |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=over 4 |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item * Brian Cassidy E<lt>bricas@cpan.orgE<gt> |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=back |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Copyright 2006 by Brian Cassidy |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
70
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=over 4 |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=item * L<Catalyst> |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item * L<Config::Any> |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=item * L<YAML> |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item * L<YAML::Syck> |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=back |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=cut |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
1; |