refactored
[catagits/Catalyst-Plugin-ConfigLoader.git] / lib / Catalyst / Plugin / ConfigLoader / XML.pm
index e44bcae..e960e6a 100644 (file)
@@ -13,13 +13,23 @@ Loads XML files. Example:
 \r
     <config>\r
         <name>TestApp</name>\r
-        <component name="Controller::Config">\r
+        <component name="Controller::Foo">\r
             <foo>bar</foo>\r
         </component>\r
     </config>\r
 \r
 =head1 METHODS\r
 \r
+=head2 extensions( )\r
+\r
+return an array of valid extensions (C<xml>).\r
+\r
+=cut\r
+\r
+sub extensions {\r
+    return qw( xml );\r
+}\r
+\r
 =head2 load( $file )\r
 \r
 Attempts to load C<$file> as an XML file.\r
@@ -27,23 +37,12 @@ Attempts to load C<$file> as an XML file.
 =cut\r
 \r
 sub load {\r
-       my $class    = shift;\r
-       my $confpath = shift;\r
-\r
-       my $file;\r
-    if( $confpath =~ /\.(.{3})$/ ) {\r
-        return unless $1 eq 'xml';\r
-        $file = $confpath;\r
-    }\r
-    else {\r
-        $file = "$confpath.xml";\r
-    }\r
-    \r
-    return unless -f $file;\r
+    my $class = shift;\r
+    my $file  = shift;\r
 \r
     require XML::Simple;\r
     XML::Simple->import;\r
-    my $config      = XMLin( $file, ForceArray => [ 'component' ] );\r
+    my $config = XMLin( $file, ForceArray => [ 'component' ] );\r
 \r
     my $components = delete $config->{ component };\r
        foreach my $element ( keys %$components ) {\r
@@ -74,6 +73,8 @@ it under the same terms as Perl itself.
 \r
 =item * L<Catalyst>\r
 \r
+=item * <Catalyst::Plugin::ConfigLoader>\r
+\r
 =back\r
 \r
 =cut\r