Skip Menu |

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

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

People
Owner: rjray [...] blackperl.com
Requestors: LEEDO [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.59
Fixed in: 0.64



Subject: No support for 64 bit integers (i8)
I found that rtorrent was outputting integers of the type 'i8' which are not understood by RPC::XML. I have attached a patch that fixes this, though it essentially just copies the i4 class into a new i8 class.
Subject: rpc-xml-i8.patch
diff -ru RPC-XML-0.59/lib/RPC/XML/Parser.pm RPC-XML-0.59-i8/lib/RPC/XML/Parser.pm --- RPC-XML-0.59/lib/RPC/XML/Parser.pm 2006-06-04 02:44:41.000000000 -0500 +++ RPC-XML-0.59-i8/lib/RPC/XML/Parser.pm 2007-10-29 22:41:36.000000000 -0500 @@ -69,7 +69,7 @@ use constant FAULTSTART => 22; # This is to identify valid types -use constant VALIDTYPES => { map { $_, 1 } qw(int i4 string double reference +use constant VALIDTYPES => { map { $_, 1 } qw(int i4 i8 string double reference boolean dateTime.iso8601 base64) }; # This maps XML tags to stack-machine tokens @@ -290,7 +290,7 @@ # Cheaper than the regex that was here, and more locale-portable $class = 'datetime_iso8601' if ($class eq 'dateTime.iso8601'); # Some minimal data-integrity checking - if ($class eq 'int' or $class eq 'i4') + if ($class eq 'int' or $class eq 'i4' or $class eq 'i8') { return error($robj, $self, 'Bad integer data read') unless ($robj->{cdata} =~ /^[-+]?\d+$/); diff -ru RPC-XML-0.59/lib/RPC/XML.pm RPC-XML-0.59-i8/lib/RPC/XML.pm --- RPC-XML-0.59/lib/RPC/XML.pm 2006-06-30 02:36:29.000000000 -0500 +++ RPC-XML-0.59-i8/lib/RPC/XML.pm 2007-10-29 22:46:04.000000000 -0500 @@ -79,6 +79,7 @@ sub RPC_BOOLEAN ( $ ) { RPC::XML::boolean->new($_[0]) } sub RPC_INT ( $ ) { RPC::XML::int->new($_[0]) } sub RPC_I4 ( $ ) { RPC::XML::i4->new($_[0]) } +sub RPC_I8 ( $ ) { RPC::XML::i8->new($_[0]) } sub RPC_DOUBLE ( $ ) { RPC::XML::double->new($_[0]) } sub RPC_DATETIME_ISO8601 ( $ ) { RPC::XML::datetime_iso8601->new($_[0]) } sub RPC_BASE64 ( $ ) { RPC::XML::base64->new($_[0]) } @@ -296,6 +297,20 @@ ############################################################################### # +# Package: RPC::XML::i8 +# +# Description: Data-type class for i8. Forces data into an int object. +# +############################################################################### +package RPC::XML::i8; + +use strict; +use vars qw(@ISA); + +@ISA = qw(RPC::XML::simple_type); + +############################################################################### +# # Package: RPC::XML::double # # Description: The "double" type-class
The joy of undocumented extensions, just the sort of thing Winer feared would happen if he didn't hold on to the spec fanatically. And yet, it happened anyway. I will add this support sometime after the 0.60 release, as I will want to have some tests and documentation in as well as the support itself. I don't want to delay 0.60 any more than it already had been.
RT-Send-CC: kevin [...] weblab.com
This will be in the next release. It got moved from "wishlist" to "needed" due to a request from a specific (high-profile) user.
On Fri Jul 25 05:32:11 2008, RJRAY wrote: Show quoted text
> This will be in the next release. It got moved from "wishlist" to > "needed" due to a request from a specific (high-profile) user.
I see the addition of i8 to RPC::XML but I am still getting this error from RPC::XML::Client Error RPC::XML::Client::send_request: parse-level error: Unknown tag encountered: i8 To fix this I added i8 to the VALIDTYPES hashref in XML::RPC::Parser. I have attached a small patch that shows the changes.
--- Parser.pm 2008-09-28 17:10:23.000000000 -0500 +++ Parser.fixed.pm 2008-09-28 17:10:07.000000000 -0500 @@ -67,7 +67,7 @@ use constant FAULTSTART => 22; # This is to identify valid types -use constant VALIDTYPES => { map { $_, 1 } qw(int i4 string double +use constant VALIDTYPES => { map { $_, 1 } qw(int i4 string double i8 boolean dateTime.iso8601 base64) }; # This maps XML tags to stack-machine tokens @@ -308,7 +308,7 @@ # Cheaper than the regex that was here, and more locale-portable $class = 'datetime_iso8601' if ($class eq 'dateTime.iso8601'); # Some minimal data-integrity checking - if ($class eq 'int' or $class eq 'i4') + if ($class eq 'int' or $class eq 'i4' or $class eq 'i8') { return error($robj, $self, 'Bad integer data read') unless ($cdata =~ /^[-+]?\d+$/);
Oh bugger. I had that change in there, but Parser.pm was also weighted down with some other work related to getting character-encodings to work. I forgot that it was part of the I8 stuff, and it didn't get committed. And to make it better, I only test the <i8></i8> stuff in t/10_data.t, no tests in t/20_parser.t.
OK, I had another change waiting to go out anyway. I just uploaded 0.64 with this properly fixes (and tests added to the parser test-suite to hopefully catch this before it happens again).