.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "XML::RPC::Enc 3pm" .TH XML::RPC::Enc 3pm "2022-06-28" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" XML::RPC::Enc \- Base class for XML::RPC encoders .SH "SYNOPSIS" .IX Header "SYNOPSIS" Generic usage .PP .Vb 1 \& use XML::RPC::Fast; \& \& my $server = XML::RPC::Fast\->new( undef, encoder => XML::RPC::Enc::LibXML\->new ); \& my $client = XML::RPC::Fast\->new( $uri, encoder => XML::RPC::Enc::LibXML\->new ); .Ve .SH "METHODS" .IX Header "METHODS" The following methods should be implemented .SS "new (%args)" .IX Subsection "new (%args)" Should support arguments: .IP "internal_encoding [ = undef ]" 4 .IX Item "internal_encoding [ = undef ]" Internal encoding. \f(CW\*(C`undef\*(C'\fR means wide perl characters (perl\-5.8.1+) .IP "external_encoding [ = utf\-8 ]" 4 .IX Item "external_encoding [ = utf-8 ]" External encoding. Which encoding to use in composed \s-1XML\s0 .ie n .SS "request ($method, @args) : xml byte-stream, [ new call url ]" .el .SS "request ($method, \f(CW@args\fP) : xml byte-stream, [ new call url ]" .IX Subsection "request ($method, @args) : xml byte-stream, [ new call url ]" Encode request into \s-1XML\s0 .SS "response (@args) : xml byte-stream" .IX Subsection "response (@args) : xml byte-stream" Encode response into \s-1XML\s0 .ie n .SS "fault ($faultcode, $faultstring) : xml byte-stream" .el .SS "fault ($faultcode, \f(CW$faultstring\fP) : xml byte-stream" .IX Subsection "fault ($faultcode, $faultstring) : xml byte-stream" Encode fault into \s-1XML\s0 .SS "registerClass ($class_name,$encoder_cb)" .IX Subsection "registerClass ($class_name,$encoder_cb)" Register encoders for custom Perl types .PP Encoders description: .PP .Vb 6 \& # Generic: \& $simple_encoder_cb = sub { \& my $object = shift; \& # ... \& return type => $string; \& }; \& \& # Encoder\-dependent (XML::RPC::Enc::LibXML) \& $complex_encoder_cb = sub { \& my $object = shift; \& # ... \& return XML::LibXML::Node; \& }; .Ve .PP Samples: .PP .Vb 3 \& $enc\->registerClass( DateTime => sub { \& return ( \*(AqdateTime.iso8601\*(Aq => $_[0]\->strftime(\*(Aq%Y%m%dT%H%M%S.%3N%z\*(Aq) ); \& }); \& \& # Encoder\-dependent (XML::RPC::Enc::LibXML) \& $enc\->registerClass( DateTime => sub { \& my $node = XML::LibXML::Element\->new(\*(AqdateTime.iso8601\*(Aq); \& $node\->appendText($_[0]\->strftime(\*(Aq%Y%m%dT%H%M%S.%3N%z\*(Aq)); \& return $node; \& }); .Ve .ie n .SS "decode ($xml) : $methodname, @args" .el .SS "decode ($xml) : \f(CW$methodname\fP, \f(CW@args\fP" .IX Subsection "decode ($xml) : $methodname, @args" Decode request xml .ie n .SS "decode ($xml) : @args" .el .SS "decode ($xml) : \f(CW@args\fP" .IX Subsection "decode ($xml) : @args" Decode response xml .SS "decode ($xml) : { fault => { faultCode => ..., faultString => ... } }" .IX Subsection "decode ($xml) : { fault => { faultCode => ..., faultString => ... } }" Decode fault xml .SS "registerType ($xmlrpc_type,$decoder_cb)" .IX Subsection "registerType ($xmlrpc_type,$decoder_cb)" Register decoders for XML-RPC types .PP \&\f(CW$decoder_cb\fR is depends on encoder implementation. .PP Samples for XML::RPC::Enc::LibXML .PP .Vb 4 \& $enc\->registerType( base64 => sub { \& my $node = shift; \& return MIME::Base64::decode($node\->textContent); \& }); \& \& $enc\->registerType( \*(AqdateTime.iso8601\*(Aq => sub { \& my $node = shift; \& return DateTime::Format::ISO8601\->parse_datetime($node\->textContent); \& }); .Ve .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright (c) 2008\-2009 Mons Anderson. .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "AUTHOR" .IX Header "AUTHOR" Mons Anderson, \f(CW\*(C`\*(C'\fR