X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FPlugin%2FConfigLoader%2FXML.pm;h=e960e6a9872f9f9e17a7674069f50b837e773100;hb=refs%2Ftags%2Fv0.02;hp=e44bcae71cc43ac887e101fa23029c5ba5047f29;hpb=b2d855940c68a8bec09c76f6235b804ef9090dc6;p=catagits%2FCatalyst-Plugin-ConfigLoader.git diff --git a/lib/Catalyst/Plugin/ConfigLoader/XML.pm b/lib/Catalyst/Plugin/ConfigLoader/XML.pm index e44bcae..e960e6a 100644 --- a/lib/Catalyst/Plugin/ConfigLoader/XML.pm +++ b/lib/Catalyst/Plugin/ConfigLoader/XML.pm @@ -13,13 +13,23 @@ Loads XML files. Example: TestApp - + bar =head1 METHODS +=head2 extensions( ) + +return an array of valid extensions (C). + +=cut + +sub extensions { + return qw( xml ); +} + =head2 load( $file ) Attempts to load C<$file> as an XML file. @@ -27,23 +37,12 @@ Attempts to load C<$file> as an XML file. =cut sub load { - my $class = shift; - my $confpath = shift; - - my $file; - if( $confpath =~ /\.(.{3})$/ ) { - return unless $1 eq 'xml'; - $file = $confpath; - } - else { - $file = "$confpath.xml"; - } - - return unless -f $file; + my $class = shift; + my $file = shift; require XML::Simple; XML::Simple->import; - my $config = XMLin( $file, ForceArray => [ 'component' ] ); + my $config = XMLin( $file, ForceArray => [ 'component' ] ); my $components = delete $config->{ component }; foreach my $element ( keys %$components ) { @@ -74,6 +73,8 @@ it under the same terms as Perl itself. =item * L +=item * + =back =cut