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> and L<XML::NamespaceSupport>
84 sub requires_all_of { 'XML::Simple', 'XML::NamespaceSupport' }
90 If, by some chance, L<XML::Simple> has already been loaded with the strict
91 flag turned on, then you will likely get errors as warnings will become
92 fatal exceptions and certain arguments to XMLin() will no longer be optional.
94 See L<XML::Simple's strict mode documentation|XML::Simple/STRICT_MODE> for
99 Brian Cassidy <bricas@cpan.org>
101 Joel Bernstein <rataxis@cpan.org>
103 =head1 COPYRIGHT AND LICENSE
105 Copyright 2006-2016 by Brian Cassidy
107 This library is free software; you can redistribute it and/or modify
108 it under the same terms as Perl itself.
116 =item * L<Config::Any>
118 =item * L<XML::Simple>