Subject: | SimpleDB::Class::HTTP should use XML::Simple with ForceArray for Item entries |
SimpleDB::Class::HTTP would be a bit more user friendly on a standalone
basis if the results always came back with Item as an array ref.
A patch to do so is attached. It might require some additional
alterations in SimpleDB::Class::ResultSet, particularly for count(*),
but I didn't have time to really grok it all.
-- David
Subject: | force-array.diff |
diff --git a/lib/SimpleDB/Class/HTTP.pm b/lib/SimpleDB/Class/HTTP.pm
index 7495c77..b796bc5 100644
--- a/lib/SimpleDB/Class/HTTP.pm
+++ b/lib/SimpleDB/Class/HTTP.pm
@@ -224,7 +224,9 @@ The HTTP headers.
sub handle_response {
my ($self, $response) = @_;
- my $content = eval {XML::Simple::XMLin($response->content)};
+ my $content = eval {
+ XML::Simple::XMLin($response->content, ForceArray => ['Item'])
+ };
# choked reconstituing the XML, probably because it wasn't XML
if ($@) {