Subject: | blows up when bundles provide config data containing refs which aren't array refs |
Date: | Thu, 6 May 2010 20:34:03 +0200 |
To: | bug-Config-MVP [...] rt.cpan.org |
From: | Florian Ragwitz <rafl [...] debian.org> |
From Config/MVP/Assembler/WithBundles.pm:
# XXX: Clearly this is a hack. -- rjbs, 2009-08-24
for my $name (keys %$payload) {
my @v = ref $payload->{$name}
? @{$payload->{$name}}
: $payload->{$name};
$section->add_value($name => $_) for @v;
}
While writing a plugin bundle recently, the above hack bit me. I returned an
URI instance instead of a string representing the URI and got a cryptic error
outside of my code back.
I guess throwing a proper expection when a reference of an unsupported type,
i.e. anything that isn't not blessed and an arrayref, would be a reasonable
solution.
--
BOFH excuse #283:
Lawn mower blade in your fan need sharpening
Message body not shown because it is not plain text.