1 package Config::Any::XML;
6 use base 'Config::Any::Base';
10 Config::Any::XML - Load XML config files
14 Loads XML files. Example:
18 <component name="Controller::Foo">
30 return an array of valid extensions (C<xml>).
40 Attempts to load C<$file> as an XML file.
47 my $args = shift || {};
50 my $config = XML::Simple::XMLin(
52 ForceArray => [ qw( component model view controller ) ],
56 return $class->_coerce( $config );
60 # coerce the XML-parsed config into the correct format
64 for my $k ( keys %$config ) {
65 my $ref = $config->{ $k };
66 my $name = ref $ref eq 'HASH' ? delete $ref->{ name } : undef;
67 if ( defined $name ) {
68 $out->{ $k }->{ $name } = $ref;
77 =head2 requires_all_of( )
79 Specifies that this module requires L<XML::Simple> in order to work.
83 sub requires_all_of { 'XML::Simple' }
89 If, by some chance, L<XML::Simple> has already been loaded with the strict
90 flag turned on, then you will likely get errors as warnings will become
91 fatal exceptions and certain arguments to XMLin() will no longer be optional.
93 See L<XML::Simple's strict mode documentation|XML::Simple/STRICT_MODE> for
98 Brian Cassidy E<lt>bricas@cpan.orgE<gt>
100 Joel Bernstein E<lt>rataxis@cpan.orgE<gt>
102 =head1 COPYRIGHT AND LICENSE
104 Copyright 2006-2009 by Brian Cassidy
106 This library is free software; you can redistribute it and/or modify
107 it under the same terms as Perl itself.
115 =item * L<Config::Any>
117 =item * L<XML::Simple>