{
    "mode": "perldoc",
    "parameter": "XML::RPC::README",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/XML%3A%3ARPC%3A%3AREADME/json",
    "generated": "2026-06-10T16:29:04Z",
    "synopsis": "Generic usage\nuse XML::RPC::Fast;\nmy $server = XML::RPC::Fast->new( undef, %args );\nmy $client = XML::RPC::Fast->new( $uri,  %args );\nCreate a simple XML-RPC service:\nuse XML::RPC::Fast;\nmy $rpc = XML::RPC::Fast->new(\nundef,                         # the url is not required by server\nexternalencoding => 'koi8-r', # any encoding, accepted by Encode\n#internalencoding => 'koi8-r', # not supported for now\n);\nmy $xml = do { local $/; <STDIN> };\nlength($xml) == $ENV{CONTENTLENGTH} or warn \"Content-Length differs from actually received\";\nprint \"Content-type: text/xml; charset=$rpc->{externalencoding}\\n\\n\";\nprint $rpc->receive( $xml, sub {\nmy ( $methodname, @params ) = @;\nreturn { youcalled => $methodname, withparams => \\@params };\n} );\nMake a call to an XML-RPC service:\nuse XML::RPC::Fast;\nmy $rpc = XML::RPC::Fast->new(\n'http://your.hostname/rpc/url'\n);\n# Syncronous call\nmy @result = $rpc->req(\ncall => [ 'examples.getStateStruct', { state1 => 12, state2 => 28 } ],\nurl => 'http://...',\n);\n# Syncronous call (compatibility method)\nmy @result = $rpc->call( 'examples.getStateStruct', { state1 => 12, state2 => 28 } );\n# Syncronous or asyncronous call\n$rpc->req(\ncall => ['examples.getStateStruct', { state1 => 12, state2 => 28 }],\ncb   => sub {\nmy @result = @;\n},\n);\n# Syncronous or asyncronous call (compatibility method)\n$rpc->call( sub {\nmy @result = @;\n}, 'examples.getStateStruct', { state1 => 12, state2 => 28 } );",
    "sections": {
        "NAME": {
            "content": "XML::RPC::Fast - Fast and modular implementation for an XML-RPC client and server\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "Generic usage\n\nuse XML::RPC::Fast;\n\nmy $server = XML::RPC::Fast->new( undef, %args );\nmy $client = XML::RPC::Fast->new( $uri,  %args );\n\nCreate a simple XML-RPC service:\n\nuse XML::RPC::Fast;\n\nmy $rpc = XML::RPC::Fast->new(\nundef,                         # the url is not required by server\nexternalencoding => 'koi8-r', # any encoding, accepted by Encode\n#internalencoding => 'koi8-r', # not supported for now\n);\nmy $xml = do { local $/; <STDIN> };\nlength($xml) == $ENV{CONTENTLENGTH} or warn \"Content-Length differs from actually received\";\n\nprint \"Content-type: text/xml; charset=$rpc->{externalencoding}\\n\\n\";\nprint $rpc->receive( $xml, sub {\nmy ( $methodname, @params ) = @;\nreturn { youcalled => $methodname, withparams => \\@params };\n} );\n\nMake a call to an XML-RPC service:\n\nuse XML::RPC::Fast;\n\nmy $rpc = XML::RPC::Fast->new(\n'http://your.hostname/rpc/url'\n);\n\n# Syncronous call\nmy @result = $rpc->req(\ncall => [ 'examples.getStateStruct', { state1 => 12, state2 => 28 } ],\nurl => 'http://...',\n);\n\n# Syncronous call (compatibility method)\nmy @result = $rpc->call( 'examples.getStateStruct', { state1 => 12, state2 => 28 } );\n\n# Syncronous or asyncronous call\n$rpc->req(\ncall => ['examples.getStateStruct', { state1 => 12, state2 => 28 }],\ncb   => sub {\nmy @result = @;\n},\n);\n\n# Syncronous or asyncronous call (compatibility method)\n$rpc->call( sub {\nmy @result = @;\n\n}, 'examples.getStateStruct', { state1 => 12, state2 => 28 } );\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "XML::RPC::Fast is format-compatible with XML::RPC, but may use different encoders to\nparse/compose xml. Curerntly included encoder uses XML::LibXML, and is 3 times faster than\nXML::RPC and 75% faster, than XML::Parser implementation\n",
            "subsections": []
        },
        "METHODS": {
            "content": "new ($url, %args)\nCreate XML::RPC::Fast object, server if url is undef, client if url is defined\n\nreq( %ARGS )\nClientside. Make syncronous or asyncronous call (depends on UA).\n\nIf have cb, will invoke $cb with results and should not croak\n\nIf have no cb, will return results and croak on error (only syncronous UA)\n\nArguments are\n\ncall => [ methodName => @args ]\narray ref of call arguments. Required\n\ncb => $cb->(@results)\nInvocation callback. Optional for syncronous UA. Behaviour is same as in call with $cb and\nwithout\n\nurl => $requesturl\nAlternative invocation URL. Optional. By default will be used defined from constructor\n\nheaders => { http-headers hashref }\nAdditional http headers to request\n\nexternalencoding => '...,\nSpecify the encoding, used inside XML container just for this request. Passed to encoder\n\ncall( 'methodname', @arguments ) : @results\nClientside. Make syncronous call and return results. Croaks on error. Just a simple wrapper\naround \"req\"\n\ncall( $cb->(@res), 'methodname', @arguments ): void\nClientside. Make syncronous or asyncronous call (depends on UA) and invoke $cb with results.\nShould not croak. Just a simple wrapper around \"req\"\n\nreceive ( $xml, $handler->($methodName,@args) ) : xml byte-stream\nServerside. Process received XML and invoke $handler with parameters $methodName and @args and\nreturns response XML\n\nOn error conditions $handler could set $XML::RPC::Fast::faultCode and die, or return\n\"rpcfault($faultCode,$faultString)\"\n\n->receive( $xml, sub {\n# ...\nreturn rpcfault( 3, \"Some error\" ) if $errorcondition\n$XML::RPC::Fast::faultCode = 4 and die \"Another error\" if $anothererrorcondition;\n\nreturn { call => $methodname, params => \\@params };\n})\n\nregisterType\nProxy-method to encoder. See XML::RPC::Enc\n\nregisterClass\nProxy-method to encoder. See XML::RPC::Enc\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "Below is the options, accepted by new()\n\nua\nClient only. Useragent object, or package name\n\n->new( $url, ua => 'LWP' ) # same as XML::RPC::UA::LWP\n# or\n->new( $url, ua => 'XML::RPC::UA::LWP' )\n# or\n->new( $url, ua => XML::RPC::UA::LWP->new( ... ) )\n# or\n->new( $url, ua => XML::RPC::UA::Curl->new( ... ) )\n\ntimeout\nClient only. Timeout for calls. Passed directly to UA\n\n->new( $url, ua => 'LWP', timeout => 10 )\n\nuseragent\nClient only. Useragent string. Passed directly to UA\n\n->new( $url, ua => 'LWP', useragent => 'YourClient/1.11' )\n\nencoder\nClient and server. Encoder object or package name\n\n->new( $url, encoder => 'LibXML' )\n# or\n->new( $url, encoder => 'XML::RPC::Enc::LibXML' )\n# or\n->new( $url, encoder => XML::RPC::Enc::LibXML->new( ... ) )\n\ninternalencoding NOT IMPLEMENTED YET\nSpecify the encoding you are using in your code. By default option is undef, which means flagged\nutf-8 For translations is used Encode, so the list of accepted encodings fully derived from it.\n\nexternalencoding\nSpecify the encoding, used inside XML container. By default it's utf-8. Passed directly to\nencoder\n\n->new( $url, encoder => 'LibXML', externalencoding => 'koi8-r' )\n",
            "subsections": []
        },
        "ACCESSORS": {
            "content": "url\nGet or set client url\n\nencoder\nDirect access to encoder object\n\nua\nDirect access to useragent object\n",
            "subsections": []
        },
        "FUNCTIONS": {
            "content": "rpcfault(faultCode, faultString)\nReturns hash structure, that may be returned by serverside handler, instead of die. Not exported\nby default\n",
            "subsections": []
        },
        "CUSTOM TYPES": {
            "content": "sub {{ 'base64' => encodebase64($data) }}\nWhen passing a CODEREF as a value, encoder will simply use the returned hashref as a type =>\nvalue pair.\n\nbless( do{\\(my $o = encodebase64('test') )}, 'base64' )\nWhen passing SCALARREF as a value, package name will be taken as type and dereference as a value\n\nbless( do{\\(my $o = { something =>'complex' } )}, 'base64' )\nWhen passing REFREF as a value, package name will be taken as type and\nXML::Hash::LX\"::hash2xml(deref)\" would be used as value\n\ncustomtype( $type, $data )\nEasily compose SCALARREF based custom type\n\nBUGS & SUPPORT\nBugs reports and testcases are welcome.\n\nIt you write your own Enc or UA, I may include it into distribution\n\nIf you have propositions for default custom types (see Enc), send me patches\n\nSee <http://rt.cpan.org> to report and view bugs.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Mons Anderson, \"<mons@cpan.org>\"\n\nCOPYRIGHT & LICENSE\nCopyright (c) 2008-2009 Mons Anderson.\n\nThis program is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
            "subsections": []
        }
    },
    "summary": "XML::RPC::Fast - Fast and modular implementation for an XML-RPC client and server",
    "flags": [],
    "examples": [],
    "see_also": []
}