Revision history for Config-Any
0.18 XXX
+ - ensure XML loader's _coerce() method checks specifically for HASH refs
- add YAML::XS to the top of the YAML loaders list
0.17 Thu 05 Feb 2009
}
sub _coerce {
-
# coerce the XML-parsed config into the correct format
my $class = shift;
my $config = shift;
my $out;
for my $k ( keys %$config ) {
my $ref = $config->{ $k };
- my $name = ref $ref ? delete $ref->{ name } : undef;
+ my $name = ref $ref eq 'HASH' ? delete $ref->{ name } : undef;
if ( defined $name ) {
$out->{ $k }->{ $name } = $ref;
}
plan skip_all => 'XML format not supported';
}
else {
- plan tests => 4;
+ plan tests => 6;
}
{
ok( !$config, 'config load failed' );
ok( $@, "error thrown ($@)" );
}
+
+# test conf file with array ref
+{
+ my $file = 't/conf/conf_arrayref.xml';
+ my $config = eval { Config::Any::XML->load( $file ) };
+
+ ok( $config, 'config loaded' );
+ ok( !$@, 'no error thrown' );
+}