updated pod + tests
[catagits/Catalyst-Plugin-ConfigLoader.git] / lib / Catalyst / Plugin / ConfigLoader / Perl.pm
index a7beb2a..5796dfd 100644 (file)
@@ -12,14 +12,27 @@ Catalyst::Plugin::ConfigLoader::Perl - Load Perl config files
 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
@@ -27,22 +40,10 @@ Attempts to load C<$file> as a Perl file.
 =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
@@ -66,6 +67,8 @@ it under the same terms as Perl itself.
 \r
 =item * L<Catalyst>\r
 \r
+=item * L<Catalyst::Plugin::ConfigLoader>\r
+\r
 =back\r
 \r
 =cut\r