1 package Catalyst::Plugin::ConfigLoader::YAML;
\r
10 Catalyst::Plugin::ConfigLoader::YAML - Load YAML config files
\r
14 Loads YAML files. Example:
\r
23 =head2 load( $file )
\r
25 Attempts to load C<$file> as a YAML file.
\r
31 my $confpath = shift;
\r
34 if( $confpath =~ /\.(.{3,4})$/ ) {
\r
35 return unless $1 =~ /^ya?ml$/;
\r
39 @files = map { "$confpath.$_" } qw( yml yaml );
\r
42 for my $file ( @files ) {
\r
43 next unless -f $file;
\r
45 eval { require YAML::Syck; };
\r
48 return YAML::LoadFile( $file );
\r
51 my $content = read_file( $file );
\r
52 return YAML::Syck::Load( $content );
\r
61 =item * Brian Cassidy E<lt>bricas@cpan.orgE<gt>
\r
65 =head1 COPYRIGHT AND LICENSE
\r
67 Copyright 2006 by Brian Cassidy
\r
69 This library is free software; you can redistribute it and/or modify
\r
70 it under the same terms as Perl itself.
\r