X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FPlugin%2FConfigLoader%2FPerl.pm;h=5796dfdcf57b52166b8f2017da59b87ee2728772;hb=eac30db5b361d325199e239152cac3310d56fb1e;hp=a7beb2a887dfdcb61bda4701d115a766823e3b85;hpb=b2d855940c68a8bec09c76f6235b804ef9090dc6;p=catagits%2FCatalyst-Plugin-ConfigLoader.git diff --git a/lib/Catalyst/Plugin/ConfigLoader/Perl.pm b/lib/Catalyst/Plugin/ConfigLoader/Perl.pm index a7beb2a..5796dfd 100644 --- a/lib/Catalyst/Plugin/ConfigLoader/Perl.pm +++ b/lib/Catalyst/Plugin/ConfigLoader/Perl.pm @@ -12,14 +12,27 @@ Catalyst::Plugin::ConfigLoader::Perl - Load Perl config files Loads Perl files. Example: { - name => 'TestApp', - Controller::Config => { + name => 'TestApp', + Controller::Foo => { foo => 'bar' + }, + Model::Baz => { + qux => 'xyzzy' } } =head1 METHODS +=head2 extensions( ) + +return an array of valid extensions (C, C). + +=cut + +sub extensions { + return qw( pl perl ); +} + =head2 load( $file ) Attempts to load C<$file> as a Perl file. @@ -27,22 +40,10 @@ Attempts to load C<$file> as a Perl file. =cut sub load { - my $class = shift; - my $confpath = shift; + my $class = shift; + my $file = shift; - my @files; - if( $confpath =~ /\.(.{2,4})$/ ) { - return unless $1 =~ /^p(er)?l$/; - @files = $confpath; - } - else { - @files = map { "$confpath.$_" } qw( pl perl ); - } - - for my $file ( @files ) { - next unless -f $file; - return eval { require $file }; - } + return eval { require $file }; } =head1 AUTHOR @@ -66,6 +67,8 @@ it under the same terms as Perl itself. =item * L +=item * L + =back =cut