XML::RPC::Enc::LibXML(3) 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

Default encoder/decoder for XML::RPC::Fast

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")

Ty avoid default decoders setup:

    BEGIN {
        $XML::RPC::Enc::LibXML::TYPES{base64} = 0;
        $XML::RPC::Enc::LibXML::TYPES{'dateTime.iso8601'} = 0;
    }
    use XML::RPC::Enc::LibXML;

IMPLEMENTED METHODS

new

request

response

fault

decode

registerType

registerClass

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, "<[email protected]>"