#594887 libfrontier-rpc-perl: sub decode fails to decode values of type double when using 'use-objects'

#594887#5
Date:
2010-08-30 12:26:03 UTC
From:
To:
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