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 if (eval { require YAML::XS; 1 }) {
49 return YAML::XS::LoadFile( $file );
51 elsif ($] > 5.008008 && eval { require YAML::Syck; YAML::Syck->VERSION(0.70) } ) {
52 open( my $fh, $file ) or die $!;
53 my $content = do { local $/; <$fh> };
55 return YAML::Syck::Load( $content );
59 return YAML::LoadFile( $file );
62 =head2 requires_any_of( )
64 Specifies that this modules requires one of L<YAML::XS>, L<YAML::Syck> (0.70) or
65 L<YAML> in order to work.
70 'YAML::XS', ( $] > 5.008008 ? [ 'YAML::Syck', '0.70' ] : ()), 'YAML';
75 Brian Cassidy E<lt>bricas@cpan.orgE<gt>
77 =head1 COPYRIGHT AND LICENSE
79 Copyright 2006-2016 by Brian Cassidy
81 This library is free software; you can redistribute it and/or modify
82 it under the same terms as Perl itself.
90 =item * L<Config::Any>