XML::R...:LibXML(3pm)
π XML::RPC::Enc::LibXML π
okay bestie so this page is from the User Contributed Perl Documentation section of the manual, and it's all about XML::RPC::Enc::LibXML(3pm) β the encoder/decoder that does XML-RPC with LibXML. let's get into it π«Ά
β¨ NAME β¨
XML::RPC::Enc::LibXML β Encode/decode XML-RPC using LibXML
πΈ SYNOPSIS πΈ
use XML::RPC::Fast;
use XML::RPC::Enc::LibXML;
my $rpc = XML::RPC::Fast->new(
$uri,
encoder => XML::RPC::Enc::LibXML->new(
# internal_encoding currently not implemented, always want wide chars
internal_encoding => undef,
external_encoding => 'windows-1251',
)
);
$rpc->registerType( base64 => sub {
my $node = shift;
return MIME::Base64::decode($node->textContent);
});
$rpc->registerType( 'dateTime.iso8601' => sub {
my $node = shift;
return DateTime::Format::ISO8601->parse_datetime($node->textContent);
});
$rpc->registerClass( DateTime => sub {
return ( 'dateTime.iso8601' => $_[0]->strftime('%Y%m%dT%H%M%S.%3N%z') );
});
$rpc->registerClass( DateTime => sub {
my $node = XML::LibXML::Element->new('dateTime.iso8601');
$node->appendText($_[0]->strftime('%Y%m%dT%H%M%S.%3N%z'));
return $node;
});
π DESCRIPTION π
so this is literally the default encoder/decoder for XML::RPC::Fast. that's the vibe. π
If MIME::Base64 is installed, decoder for "XML-RPC" type "base64" will be setup
If DateTime::Format::ISO8601 is installed, decoder for "XML-RPC" type "dateTime.iso8601" will be setup
Also will be setup by default encoders for Class::Date and DateTime (will be encoded as "dateTime.iso8601")
and listen, if you wanna skip the default decoders setup entirely, here's the move:
BEGIN {
$XML::RPC::Enc::LibXML::TYPES{base64} = 0;
$XML::RPC::Enc::LibXML::TYPES{'dateTime.iso8601'} = 0;
}
use XML::RPC::Enc::LibXML;
(the typo up there is Ty avoid default decoders setup in the original, no cap β you get it, it means to avoid. π)
π IMPLEMENTED METHODS π
β new
β request
β response
β fault
β decode
β registerType
β registerClass
π¦ SEE ALSO π¦
XML::RPC::Encβ Base class (also contains documentation)
okay so the original also drops a whole Q&A section right here and it's kinda iconic so here it is, verbatim-ish in spirit:
Q: What is the legal syntax (and range) for integers? How to deal with leading zeros? Is a leading plus sign allowed? How to deal with whitespace?
A: An integer is a 32-bit signed number. You can include a plus or minus at the beginning of a string of numeric characters. Leading zeros are collapsed. Whitespace is not permitted. Just numeric characters preceded by a plus or minus.
Q: What is the legal syntax (and range) for floating point values (doubles)? How is the exponent represented? How to deal with whitespace? Can infinity and "not a number" be represented?
A: There is no representation for infinity or negative infinity or "not a number". At this time, only decimal point notation is allowed, a plus or a minus, followed by any number of numeric characters, followed by a period and any number of numeric characters. Whitespace is not allowed. The range of allowable values is implementation-dependent, is not specified.
# int
'+0' => 0
'-0' => 0
'+1234567' => 1234567
'0777' => 777
'0000000000000' => 0
'0000000000000000000000000000000000000000000000000' => 0
# not int
'999999999999999999999999999999999999';
ngl bestie, that last one is not an int. it's giving "too many digits, sweetie". π
π COPYRIGHT & LICENSE π
Copyright (c) 2008-2009 Mons Anderson.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
π AUTHOR π
Mons Anderson, "<mons@cpan.org>"
okay that's the whole page, you ate it, periodt. πβ¨ this was XML::RPC::Enc::LibXML(3pm) from the User Contributed Perl Documentation, perl v5.34.0, dated 2022-06-28 β mwah, go slay some XML-RPC ππ¦π
π¦ where this page comes from
- debian bookworm: libxml-rpc-fast-perl 0.8-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libxml-rpc-fast-perl 0.8-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libxml-rpc-fast-perl 0.8-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libxml-rpc-fast-perl 0.8-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libxml-rpc-fast-perl 0.8-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms