X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FPlugin%2FConfigLoader%2FINI.pm;h=a5c28f654650459973fd3f59e68b6fa16e95e135;hb=d6277728a99503a632fec6c5bed6b5b23db122cc;hp=df263da2e56be898c1fdfb5b96d03bb9fd3103dc;hpb=b2d855940c68a8bec09c76f6235b804ef9090dc6;p=catagits%2FCatalyst-Plugin-ConfigLoader.git diff --git a/lib/Catalyst/Plugin/ConfigLoader/INI.pm b/lib/Catalyst/Plugin/ConfigLoader/INI.pm index df263da..a5c28f6 100644 --- a/lib/Catalyst/Plugin/ConfigLoader/INI.pm +++ b/lib/Catalyst/Plugin/ConfigLoader/INI.pm @@ -13,11 +13,21 @@ Loads INI files. Example: name=TestApp - [Controller::Config] + [Controller::Foo] foo=bar =head1 METHODS +=head2 extensions( ) + +return an array of valid extensions (C). + +=cut + +sub extensions { + return qw( ini ); +} + =head2 load( $file ) Attempts to load C<$file> as an INI file. @@ -25,23 +35,13 @@ Attempts to load C<$file> as an INI file. =cut sub load { - my $class = shift; - my $confpath = shift; - - my $file; - if( $confpath =~ /\.(.{3})$/ ) { - return unless $1 eq 'ini'; - $file = $confpath; - } - else { - $file = "$confpath.ini"; - } - - return unless -f $file; + my $class = shift; + my $file = shift; require Config::Tiny; my $config = Config::Tiny->read( $file ); my $main = delete $config->{ _ }; + $config->{ $_ } = $main->{ $_ } for keys %$main; return $config; @@ -68,6 +68,8 @@ it under the same terms as Perl itself. =item * L +=item * L + =back =cut