1 package Config::Any::YAML;
6 use base 'Config::Any::Base';
12 Config::Any::YAML - Load YAML config files
16 Loads YAML files. Example:
30 return an array of valid extensions (C<yml>, C<yaml>).
35 return qw( yml yaml );
40 Attempts to load C<$file> as a YAML file.
48 eval { require YAML::XS };
50 return YAML::XS::LoadFile( $file );
54 'Use of YAML::Syck or YAML to parse config files is DEPRECATED. '
55 . 'Please install YAML::XS for proper YAML support';
57 eval { require YAML::Syck; YAML::Syck->VERSION( '0.70' ) };
59 open( my $fh, $file ) or die $!;
60 my $content = do { local $/; <$fh> };
62 return YAML::Syck::Load( $content );
66 return YAML::LoadFile( $file );
69 =head2 requires_any_of( )
71 Specifies that this modules requires one of L<YAML::XS>, L<YAML::Syck> (0.70) or
72 L<YAML> in order to work.
76 sub requires_any_of { 'YAML::XS', [ 'YAML::Syck', '0.70' ], 'YAML' }
80 Brian Cassidy E<lt>bricas@cpan.orgE<gt>
82 =head1 COPYRIGHT AND LICENSE
84 Copyright 2006-2009 by Brian Cassidy
86 This library is free software; you can redistribute it and/or modify
87 it under the same terms as Perl itself.
95 =item * L<Config::Any>
101 =item * L<YAML::Syck>