From: Brian Cassidy Date: Tue, 9 May 2006 23:48:04 +0000 (+0000) Subject: ConfigLoader updated to version 0.07 X-Git-Tag: 5.7099_04~598 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=commitdiff_plain;h=c7b9fd14369947e369470e283e1dee9891e6f76d;hp=af00c122ea90cce0d758c8757d0746b14211d4bf ConfigLoader updated to version 0.07 --- diff --git a/Changes b/Changes index 6ad4142..54dffe5 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,7 @@ This file documents the revision history for Perl extension Catalyst. - Fix ->config failing to copy _config for subclassing + - ConfigLoader: Updated to version 0.07 5.6902 2006-05-04 13:00:00 - Remove tarballs and OSX metadata files. diff --git a/lib/Catalyst/Plugin/ConfigLoader.pm b/lib/Catalyst/Plugin/ConfigLoader.pm index c50c0f5..374dc41 100644 --- a/lib/Catalyst/Plugin/ConfigLoader.pm +++ b/lib/Catalyst/Plugin/ConfigLoader.pm @@ -10,7 +10,7 @@ use Module::Pluggable::Fast require => 1; use Data::Visitor::Callback; -our $VERSION = '0.06'; +our $VERSION = '0.07'; =head1 NAME @@ -23,7 +23,7 @@ Catalyst::Plugin::ConfigLoader - Load config files of various types # ConfigLoader should be first in your list so # other plugins can get the config information use Catalyst qw( ConfigLoader ... ); - + # by default myapp.* will be loaded # you can specify a file if you'd like __PACKAGE__->config( file = > 'config.yaml' ); @@ -68,6 +68,9 @@ sub setup { for( @files ) { next unless -f $_; my $config = $loader->load( $_ ); + + _fix_syntax( $config ); + $c->config( $config ) if $config; } } @@ -104,6 +107,23 @@ sub finalize_config { $v->visit( $c->config ); } +sub _fix_syntax { + my $config = shift; + my @components = ( + map +{ + prefix => $_ eq 'Component' ? '' : $_ . '::', + values => delete $config->{ lc $_ } || delete $config->{ $_ } + }, qw( Component Model View Controller ) + ); + + foreach my $comp ( @components ) { + my $prefix = $comp->{ prefix }; + foreach my $element ( keys %{ $comp->{ values } } ) { + $config->{ "$prefix$element" } = $comp->{ values }->{ $element }; + } + } +} + =head1 AUTHOR =over 4 diff --git a/lib/Catalyst/Plugin/ConfigLoader/YAML.pm b/lib/Catalyst/Plugin/ConfigLoader/YAML.pm index 88683dc..3e521ff 100644 --- a/lib/Catalyst/Plugin/ConfigLoader/YAML.pm +++ b/lib/Catalyst/Plugin/ConfigLoader/YAML.pm @@ -74,6 +74,10 @@ it under the same terms as Perl itself. =item * L +=item * L + +=item * L + =back =cut