This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
RPC::XML
|
321
arguments passed in from the original call. See the documentation for that mod-
ule for more on the range and meaning of the parameters to
run.
dispatch(request)
A server object uses this method to actually turn a request into a server-side
method call and result. The argument may be either an XML document, a scalar
reference to the XML (to reduce the memory used in duplicating strings on the
stack), or a
RPC::XML::request object. If the argument is XML (or the scalar ref-
erence to XML), it is first converted to object form. The method then looks up
the requested method and fashions the call to that method. The return value
from this is an object of the
RPC::XML::response class.
xpl_path(optional array reference)
Gets the search path for XPL files as an array reference. If passed with an array
reference as an argument, it sets a new search path for XPL files. This com-
pletely replaces the existing list, so to augment a list, the application must first
retrieve the current list and include it in the new one. The old path is returned as
an array reference when setting a new path.
Server-Side Code Classes
Server-side code can behave as ordinary subroutines or as class methods, depending
on the way the code is hooked into the server. The
RPC::XML package uses a set of dif-
ferent code object classes to maintain the difference between the types.
Details of the XPL file format are provided in the module documentation and won’t
be covered here.
Each class supports the following methods:
new(arguments)
This is the constructor for the class. The arguments may be either a filename (if
there is exactly one argument that isn’t a reference), a hash reference, or a list of
key/value pairs. The file is assumed to be a XPL file and the constructor will
attempt to load it. The hash reference is assumed to be contain some subset of
the keys listed here and will be copied to a new reference which is then blessed
into the correct package. If the arguments are a series of key/value pairs, the fol-
lowing keys are recognized:
name
The name by which the code object is published on a server.
code
A code reference to the Perl subroutine/closure that is actually executed for
requests. Symbolic references aren’t accepted.
signature
This key may appear more than once. Each time, it specifies a signature that
the new code object can accept. The signature may be a string or an array

Get Programming Web Services with Perl now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.