Skip Menu |

This queue is for tickets about the RPC-XML CPAN distribution.

Report information
The Basics
Id: 113620
Status: resolved
Priority: 0/
Queue: RPC-XML

People
Owner: Nobody in particular
Requestors: markus [...] wernig.net
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: RPC-XML encodes any string into RPC::XML::double that looks like a decimal
Date: Fri, 8 Apr 2016 20:07:56 +0200
To: bug-RPC-XML [...] rt.cpan.org
From: Markus Wernig <markus [...] wernig.net>
Hi all RPC-XML version: 0.77 Perl version: 5.20.1 OS: Gentoo Linux I found the following behaviour in RPC-XML: Whenever a variable that looks like a decimal is prepared into an RPC::XML::* class for sending to the server, it gets encoded as a RPC::XML::double. There seems to be no way to prevent this. Sample code: use Data::Dumper; use RPC::XML; use RPC::XML::Client; my $value = "123.4"; my $hash = { MyValue => "$val" }; my $parsed = RPC::XML::struct->new($hash); print "parsed: " . Dumper($parsed); This results in something like parsed: $VAR1 = bless( { 'MyValue' => bless( do{\(my $o = '123.4')}, 'RPC::XML::double' ) }, 'RPC::XML::struct' ); On the receiving end, the value is then decoded and passed to the application as { MyValue => '123.40000000000000568434' } This is perfectly fine for real decimals, which can be rounded on the server before using them. But what if the value was not intended as a decimal, but as a literal string? In my case, there are object identifiers (documents, references etc.) that are versioned in the format $major.$minor, with both $major and $minor being numbers, and I cannot simply round them back to a meaningful value after receiving them on the server, as version 123.4 is quite different from version 123.40. I think there should be a way to override the autodetection of those data types, or maybe there is another solution? Thanks for looking into this. Kind regards Markus -- Markus Wernig Unix/Network Security Engineer PGP: 8E82E4DC ----------------------------------------- http://xfer.ch - http://markus.wernig.net -----------------------------------------
Subject: Re: [rt.cpan.org #113620] AutoReply: RPC-XML encodes any string into RPC::XML::double that looks like a decimal
Date: Fri, 8 Apr 2016 21:16:26 +0200
To: bug-RPC-XML [...] rt.cpan.org
From: Markus Wernig <markus [...] wernig.net>
Hello again Oh well .. I had managed to overlook the $FORCE_STRING_ENCODING global variable, even thoug well documented. Sorry for the noise & thanks for the great code! kind regards Markus Show quoted text
> -------------------------------------------------------------------------
Show quoted text
> Whenever a variable that looks like a decimal is prepared into an > RPC::XML::* class for sending to the server, it gets encoded as a > RPC::XML::double. There seems to be no way to prevent this.
Download smime.p7s
application/pkcs7-signature 4k

Message body not shown because it is not plain text.

Marking this as resolved. -- Randy J. Ray rjray@blackperl.com randy.j.ray@gmail.com