Loads Perl files. Example:\r
\r
{\r
- name => 'TestApp',\r
- Controller::Config => {\r
+ name => 'TestApp',\r
+ 'Controller::Foo' => {\r
foo => 'bar'\r
+ },\r
+ 'Model::Baz' => {\r
+ qux => 'xyzzy'\r
}\r
}\r
\r
=head1 METHODS\r
\r
+=head2 extensions( )\r
+\r
+return an array of valid extensions (C<pl>, C<perl>).\r
+\r
+=cut\r
+\r
+sub extensions {\r
+ return qw( pl perl );\r
+}\r
+\r
=head2 load( $file )\r
\r
Attempts to load C<$file> as a Perl file.\r
=cut\r
\r
sub load {\r
- my $class = shift;\r
- my $confpath = shift;\r
+ my $class = shift;\r
+ my $file = shift;\r
\r
- my @files;\r
- if( $confpath =~ /\.(.{2,4})$/ ) {\r
- return unless $1 =~ /^p(er)?l$/;\r
- @files = $confpath;\r
- }\r
- else {\r
- @files = map { "$confpath.$_" } qw( pl perl );\r
- }\r
- \r
- for my $file ( @files ) {\r
- next unless -f $file;\r
- return eval { require $file };\r
- }\r
+ return eval { require $file };\r
}\r
\r
=head1 AUTHOR\r
\r
=item * L<Catalyst>\r
\r
+=item * L<Catalyst::Plugin::ConfigLoader>\r
+\r
=back\r
\r
=cut\r