1 package Config::Any::YAML;
6 use base 'Config::Any::Base';
12 Config::Any::YAML - Load YAML config files
16 Loads YAML files. Example:
29 return an array of valid extensions (C<yml>, C<yaml>).
34 return qw( yml yaml );
39 Attempts to load C<$file> as a YAML file.
47 if (eval { require YAML::XS; 1 }) {
48 return YAML::XS::LoadFile( $file );
50 elsif ($] > 5.008008 && eval { require YAML::Syck; YAML::Syck->VERSION(0.70) } ) {
51 open( my $fh, $file ) or die $!;
52 my $content = do { local $/; <$fh> };
54 return YAML::Syck::Load( $content );
58 return YAML::LoadFile( $file );
61 =head2 requires_any_of( )
63 Specifies that this modules requires one of L<YAML::XS>, L<YAML::Syck> (0.70) or
64 L<YAML> in order to work.
69 'YAML::XS', ( $] > 5.008008 ? [ 'YAML::Syck', '0.70' ] : ()), 'YAML';
74 Brian Cassidy <bricas@cpan.org>
76 =head1 COPYRIGHT AND LICENSE
78 Copyright 2006-2016 by Brian Cassidy
80 This library is free software; you can redistribute it and/or modify
81 it under the same terms as Perl itself.
89 =item * L<Config::Any>