Skip Menu |

This queue is for tickets about the XMLRPC-Lite CPAN distribution.

Report information
The Basics
Id: 125492
Status: new
Priority: 0/
Queue: XMLRPC-Lite

People
Owner: Nobody in particular
Requestors: mugolkov [...] nvidia.com
Cc:
AdminCc:

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



Subject: XMLRPC-Lite-0.717 - proper boolean type support
Date: Tue, 5 Jun 2018 11:42:33 +0000
To: "bug-XMLRPC-Lite [...] rt.cpan.org" <bug-XMLRPC-Lite [...] rt.cpan.org>
From: Mikhail Ugolkov <mugolkov [...] nvidia.com>
Dear XMLRPC-Lite maintainers, Yesterday I discovered that there is no way to send a boolean value with XMLRPC-Lite. Although you have sub as_boolean { my ($self, $value) = @_; return ['boolean', {}, $value ? 1 : 0]; } In the module source code, the input filter return $class->SUPER::new( typelookup => { base64 => [10, sub {$_[0] =~ /[^\x09\x0a\x0d\x20-\x7f]/}, 'as_base64'], int => [20, sub {$_[0] =~ /^[+-]?\d+$/}, 'as_int'], double => [30, sub {$_[0] =~ /^(-?(?:\d+(?:\.\d*)?|\.\d+)|([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?)$/}, 'as_double'], dateTime => [35, sub {$_[0] =~ /^\d{8}T\d\d:\d\d:\d\d$/}, 'as_dateTime'], string => [40, sub {1}, 'as_string'], }, Will never recognize boolean values. What I suggest is to update typelookup as follows: typelookup => { boolean => [5, sub {$_[0] =~ /^[\0\1]$/}, 'as_boolean'], base64 => [10, sub {$_[0] =~ /[^\x09\x0a\x0d\x20-\x7f]/}, 'as_base64'], int => [20, sub {$_[0] =~ /^[+-]?\d+$/}, 'as_int'], double => [30, sub {$_[0] =~ /^(-?(?:\d+(?:\.\d*)?|\.\d+)|([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?)$/}, 'as_double'], dateTime => [35, sub {$_[0] =~ /^\d{8}T\d\d:\d\d:\d\d$/}, 'as_dateTime'], string => [40, sub {1}, 'as_string'], }, JSON and JSON::XS already use \0 and \1 as scalar references for True and False, and I believe the same approach would be ok for XMLRPC-Lite. Thanks, Mikhail. ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. -----------------------------------------------------------------------------------