make the XML to hash stuff produce an empty string for empty elements instead of...
authorlevinse <levinse>
Sun, 28 Nov 2010 22:04:08 +0000 (22:04 +0000)
committerlevinse <levinse>
Sun, 28 Nov 2010 22:04:08 +0000 (22:04 +0000)
- much easier to test for empty values than to test for no specific keys in a hash

lib/Net/Ikano.pm
lib/Net/Ikano/XMLUtil.pm

index de40912..c1e4b87 100644 (file)
@@ -321,6 +321,8 @@ sub AUTOLOAD {
     return "invalid HTTP response from Ikano: " . $resp->status_line
        unless $resp->is_success;
     my $respxml = $resp->decoded_content;
+
+    $xs = new Net::Ikano::XMLUtil(RootName => undef, SuppressEmpty => '');
     my $resphash = $xs->XMLin($respxml);
 
     warn "DEBUG RESPONSE\n\tHASH:\n ".Dumper($resphash)."\n\tXML:\n $respxml"
index 0439a57..62f3a71 100644 (file)
@@ -11,8 +11,7 @@ use Switch;
 Unfortunately the Ikano API schema has xs:sequence everywhere, so we need to have most elements in a particular order.
 This class solves this problem by extending XML::Simple and overriding sorted_keys to provide the element order for each request.
 
-IMPORTANT: when using this class, XMLOut must have SuppressEmpty => 1 as an option.
-You will break everything otherwise.
+This is a helper class which should not be used directly. It requires particular options in the constructor (SuppressEmpty) which differ for XMLin and XMLout.
 
 =cut