Subject: | sub decode fails to decode values of type double when using 'use-objects' |
Date: | Mon, 16 Apr 2012 17:07:12 +0200 |
To: | bug-Frontier-RPC [...] rt.cpan.org |
From: | Herwin Weststrate <herwin [...] quarantainenet.nl> |
When running the method 'decode' on a valid XML-RPC input with the
option 'use-objects' on, every entry should be encoded as a
Frontier::RPC::<datatype> object. This fails on the type double, the
module does have code to convert a float but the float is not defined in
the specifications of XML-RPC (http://www.xmlrpc.com/spec).
An example input may look like this:
<?xml version="1.0"?>
<methodCall>
<methodName>perform_actions</methodName>
<params>
<param><name>some_string</name><value><string>X</string></value>
</param>
<param><name>some_double</name><value><double>1.2</double></value>
</param>
</params>
</methodCall>
When running it through this conversion code (shortened version):
my $coder = Frontier::RPC2->new('encoding' => 'UTF-8', 'use_objects'
=> 1);
my $test = $coder->decode($data);
print Dumper($test);
The ouput does look like this (with only relevan fields shown):
'value' => [
bless( do{\(my $o = 'X')}, 'Frontier::RPC2::String' ),
'1.2'
]
The attached patch fixes this problem
--
Herwin Weststrate
Message body is not shown because sender requested not to inline it.