Current File : //home/strato/chroot/opt/RZperl536/man/man3/Apache::RPC::Status.3
.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43)
.\"
.\" 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 "Apache::RPC::Status 3"
.TH Apache::RPC::Status 3 "2011-08-17" "perl v5.36.1" "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"
Apache::RPC::Status \- A status monitor similar to Apache::Status for RPC
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 5
\&    # In httpd.conf:
\&    </Location /rpc\-status>
\&        SetHandler perl\-script
\&        PerlHandler Apache::RPC::Status
\&    </Location>
\&
\&    # In the start\-up Perl file:
\&    use Apache::RPC::Status;
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
The \fBApache::RPC::Status\fR package is provided as a simple status monitor for
XML-RPC servers running in a \fBmod_perl\fR environment, using the
\&\fBApache::RPC::Server\fR class (or derivative of). Patterned after the status
system provided with \fBmod_perl\fR itself, information is broken down into a
series of screens providing information ranging from the \s-1RPC\s0 servers currently
configured down to the individual methods provided by the servers.
.SS "Information Screens"
.IX Subsection "Information Screens"
There are three basic screens provided by the stock \fBApache::RPC::Status\fR
package:
.IP "Main: Listing of Servers" 4
.IX Item "Main: Listing of Servers"
This screen is the first screen that comes up when the location for which this
class was assigned as a handler is invoked. It lists the server objects that
this running Apache process knows of. Note that if the servers are defined in
such a way as to mean on-demand creation, then a given child process may not
have all the configured servers in memory. This is by design, it is not a
bug. See \*(L"Usage Within <Perl> Sections\*(R" in Apache::RPC::Server for
details on configuring the \s-1RPC\s0 servers such that they are pre-loaded into all
child processes.
.IP "Server: Details of a Server" 4
.IX Item "Server: Details of a Server"
Each of the known servers in the main screen links to this screen, which
provides details on the specific server. Information such as when the server
was started (which usually matches the time that Apache was started), when the
specific child was started (which may not be the same), number of requests
servered, and so forth is provided. Additionally, each of the methods that the
server provides is listed in alphanumeric order, with a link to the next
screen.
.IP "Method: Details of a Specific Method" 4
.IX Item "Method: Details of a Specific Method"
For each of the known methods published by a server, this screen summarizes
all that is known about the method itself. The signatures, help text and
hidden status (whether the method is visible to the introspection \s-1API\s0 that is
shipped with \fBRPC::XML::Server\fR) are all shown. Some optional information is
shown if available: if the method has a version number associated with it,
that is displayed. If the method was loaded from an external \s-1XPL\s0 file, the
file path and modification-time are also displayed.
.PP
The primary purpose of this status system is to allow for checking the
availability and sanity of the \s-1RPC\s0 servers themselves. For example, if a
server is configured to auto-load methods, and automatically check for
updates, the status system could confirm that a method is available or is at
the correct version.
.PP
(Note that auto-loading and auto-updating are done on demand, when a call is
made to the method in question. Thus, the status might not reflect changes
until at least one call has been made. Further, if there are very many child
processes handling the \s-1RPC\s0 servers, several calls may be necessary to ensure
that the child process answering the status request also has the most
up-to-date impression of the server.)
.SH "SUBROUTINES/METHODS"
.IX Header "SUBROUTINES/METHODS"
This package is implemented as a method handler for Apache/mod_perl. This
means that is should be relatively easy to subclass this package to implement
an extended version of status reporting, or to provide handlers for phases of
the request lifecycle not otherwise addressed.
.SS "Class Methods"
.IX Subsection "Class Methods"
There are three class methods defined in this package. One is the constructor,
the other two are handlers for specific phases in the Apache request
lifecycle.
.IP "new(\s-1CLASS, ARGS\s0)" 4
.IX Item "new(CLASS, ARGS)"
This creates a new object of this class and returns a reference to it. The
first argument is the class being created into, the remaining arguments are
treated as key/value pairs (note: not a hash reference). At present, the only
additional argument recognized is:
.RS 4
.IP "serverclass" 8
.IX Item "serverclass"
This is used when the status monitor is being used with a server class other
than \fBApache::RPC::Server\fR directly. Because several methods from that class
are invoked, it is presumed that the class named here is a subclass of
\&\fBApache::RPC::Server\fR. If not, the status monitor may not work correctly, or
at all. In the absence of this value, \f(CW\*(C`Apache::RPC::Server\*(C'\fR is assumed. This
value may also be set with the mod_perl \fBPerlSetVar\fR directive. See the
documentation for \f(CW\*(C`init_handler\*(C'\fR, below.
.RE
.RS 4
.RE
.IP "handler(\s-1CLASS, REQUEST\s0)" 4
.IX Item "handler(CLASS, REQUEST)"
This is the primary entry-point for the package. This is the handler defined
for assignment to \f(CW\*(C`PerlHandler\*(C'\fR in a location configuration block. It is
invoked by mod_perl as a method handler, thus the first argument is either the
name of the class (in the case of class-method, or static, invocation) or the
object configured as the handler. The second argument is the Apache request
object itself.
.Sp
This method derives the query parameters for the request from the Apache
object, and treats them according to the type of information screen requested:
.RS 4
.IP "screen" 8
.IX Item "screen"
This specifies which screen of the status monitor is to be displayed. In
absence, the value defaults to \*(L"main\*(R", which is the internal identifier for
the primary screen of the status monitor system. If the value of this
parameter does not match a known interface hook, then the handler will signify
to mod_perl that it cannot handler the request, by replying with the
\&\f(CW\*(C`\f(CBDECLINED\f(CW\*(C'\fR response code.
.IP "server" 8
.IX Item "server"
When the \fBscreen\fR parameter is set to \f(CW\*(C`server\*(C'\fR, the monitor displays the
server detail screen. In that case, this parameter specifies which server
should be displayed. Servers are given unique identifiers when they are
created, usually derived from the \s-1URL\s0 path that they are attached to. If the
value here does not match any known servers, a warning is sent to the browser.
.IP "method" 8
.IX Item "method"
When the \fBscreen\fR parameter is set to \f(CW\*(C`method\*(C'\fR, this calls for the method
detail screen. The provided interface hook to deal with these requests looks
for both the \fBserver\fR parameter above and this one, which specifies by name
the method to be laid out in detail. As with the \fBserver\fR parameter, if the
value in this parameter does not match any known data, an error is reported to
the browser.
.RE
.RS 4
.Sp
Any additional parameters will be preserved by \fBmake_url\fR call detailed
below. These are merely the specific ones recognized by the status monitor as
written.
.RE
.IP "init_handler(\s-1CLASS, REQUEST\s0)" 4
.IX Item "init_handler(CLASS, REQUEST)"
This is a very simple handler designed for the \fBPerlChildInitHandler\fR
phase. At present, it only does one simple task (and thus makes no direct use
of either parameter passed to it by mod_perl). However, it is included mainly
as a placeholder for possible future expansion. The current behavior is to
check for the existence of directory-configuration item called \f(CW\*(C`ServerClass\*(C'\fR,
and record the value if it is set. This is used to specifiy the class from
which the \s-1RPC\s0 server objects are created, if something other than
\&\fBApache::RPC::Server\fR. If this information is passed via the \f(CW\*(C`serverclass\*(C'\fR
parameter to the \fBnew\fR method above, that value overrides any value
here. However, that requires actually creating an object to use as the
handler, whereas this handler may be used directly, as a static handler. It
would be configured outside of any <Location> blocks, a requirement
for the \fBPerlChildInitHandler\fR phase. It is designed to stack cleanly with
any other handlers for that phase, provided your mod_perl installation
supports stacked handlers.
.SS "Additional Methods"
.IX Subsection "Additional Methods"
In addition to the class methods above, the following are provided. In most
cases, these do not rely on any data contained within the actual object
itself. Many may also be called as static methods (these are so noted). They
are provided as a utility, implemented as methods so as to avoid namespace
issues:
.IP "version" 4
.IX Item "version"
(May be called as a static method.) Returns the current version of this
module.
.IP "apache_status_attach" 4
.IX Item "apache_status_attach"
Attach the \fBApache::RPC::Status\fR module to the main screen of the
\&\fBApache::Status\fR display.
.IP "default_object" 4
.IX Item "default_object"
(May be called as a static method.) Returns a default \fBApache::RPC::Status\fR
instance when called as a static method. Returns the calling reference itself,
otherwise.
.IP "header(\s-1REQUEST, TITLE\s0)" 4
.IX Item "header(REQUEST, TITLE)"
Produces the \s-1HTML\s0 header for a page. Uses the passed-in title parameter to
give the page a title, and extracts any request-specific information from the
\&\fBApache\fR request object passed as the first parameter.
.IP "footer(\s-1REQUEST\s0)" 4
.IX Item "footer(REQUEST)"
Produces the \s-1HTML\s0 footer.
.IP "make_url(QUERY|REQUEST, \s-1FLAG\s0)" 4
.IX Item "make_url(QUERY|REQUEST, FLAG)"
(May be called as a static method.) This creates a \s-1URL\s0 string for use as a
hyperlink. It makes certain to preserve all parameters in a CGI-like
fashion. Additionally, it can make the \s-1URL\s0 in such a fashion as to allow
better integration with the \fBApache::Status\fR package. If the \f(CW\*(C`FLAG\*(C'\fR
parameter is passed and is any true value, then the resulting \s-1URL\s0 will be
tailored for use with \fBApache::Status\fR. The first argument must be either the
original request object as passed by mod_perl, or a reference to a \s-1CGI\s0 object
created from the request (see \s-1CGI\s0 for more on the \s-1CGI\s0 class).
.IP "main_screen(\s-1REQUEST, QUERY, INTERNAL\s0)" 4
.IX Item "main_screen(REQUEST, QUERY, INTERNAL)"
Renders the \s-1HTML\s0 (minus the header and footer) for the main screen. The
arguments are the \fBApache\fR request object, a \fB\s-1CGI\s0\fR query object created
from the request, and a boolean flag indicating whether the call into this
method was made from within this module or made from the \fBApache::Status\fR
page.
.IP "server_summary(\s-1SERVER\s0)" 4
.IX Item "server_summary(SERVER)"
Creates an \s-1HTML\s0 snippet to provide a summary for the server passed in as an
argument. The passed-in value should be the server object, not the name.
.IP "server_detail(\s-1REQUEST, QUERY, INTERNAL\s0)" 4
.IX Item "server_detail(REQUEST, QUERY, INTERNAL)"
Renders the \s-1HTML\s0 (minus header and footer) for a screen describing a server
instance in detail. The server is specified by name in the query parameters.
The arguments are the same as for \f(CW\*(C`main_screen\*(C'\fR.
.IP "method_summary(\s-1SERVER, METHOD, BASEURL\s0)" 4
.IX Item "method_summary(SERVER, METHOD, BASEURL)"
Creates and \s-1HTML\s0 snippet to provide a summary for the specified method of the
specified server. The third argument is a base-URL to use for making links to
the detailed method page.
.IP "method_detail(\s-1REQUEST, QUERY, INTERNAL\s0)" 4
.IX Item "method_detail(REQUEST, QUERY, INTERNAL)"
Renders the \s-1HTML\s0 (minus header and footer) for a screen describing a method on
a specific server instance, in detail. The method and server are specified by
name in the query parameters. The arguments are the same as for
\&\f(CW\*(C`main_screen\*(C'\fR.
.SS "Use and Extension Within Perl Sections"
.IX Subsection "Use and Extension Within Perl Sections"
Some extension may be done without necessarily subclassing this package. The
class object are implemented simply as hash references. When a request is
received, the \fBscreen\fR parameter (see above) is extracted, and used to look
up in the hash table. If there is a value for that key, the value is assumed
to be a hash reference with at least two keys (described below). If it does
not exist, the handler routine declines to handle the request. Thus, some
degree of extension may be done without the need for developing a new class,
if the configuration and manipulation are done within <Perl>
configuration blocks.
.PP
Adding a new screen means writing a routine to handle the requests, and then
adding a hook into that routine to the object that is the handler for the
Apache location that serves \s-1RPC\s0 status requests. The routines that are written
to handle a request should expect four arguments (in order):
.IP "The object reference for the location handler" 4
.IX Item "The object reference for the location handler"
.PD 0
.IP "The Apache request object reference" 4
.IX Item "The Apache request object reference"
.IP "A query object reference (see below)" 4
.IX Item "A query object reference (see below)"
.IP "A flag that is only passed when called from Apache::Status" 4
.IX Item "A flag that is only passed when called from Apache::Status"
.PD
.PP
The routines are given both the original request object and a query object
reference for sake of ease. The query object is already available prior to the
dispatch, so there is no reason to have each hook routine write the same few
lines to derive a query object from an Apache request. At the same time, the
hooks themselves may need the Apache object to call methods on. The query
object is an instance of \fB\s-1CGI\s0\fR. The flag parameter is passed by the linkage
from this status package to \fBApache::Status\fR. The primary use for it is to
pass to routines such as \fBmake_url\fR that are sensitive to the
\&\fBApache::Status\fR context.
.PP
The return value from these routines must be a reference to a list of lines of
text. It is passed to the \fBprint\fR method of the \fBApache\fR class. This is
necessary for compatibility with the \fBApache::Status\fR environment.
.PP
To add a new hook, merely assign it to the object directly. The key is the
value of the \f(CW\*(C`screen\*(C'\fR parameter defined above, and the value is a hash
reference with two keys:
.IP "title" 4
.IX Item "title"
A string that is incorporated into the \s-1HTML\s0 title for the page.
.IP "call" 4
.IX Item "call"
A reference to a subroutine or closure that implements the hook, and conforms
to the conventions described above.
.PP
A sample addition:
.PP
.Vb 4
\&    $stat_obj\->{dbi} = {
\&                           title => \*(AqRPC\-side DBI Pool\*(Aq,
\&                           call  => \e&show_dbi_pool
\&                       };
.Ve
.SH "INTEGRATION WITH Apache::Status"
.IX Header "INTEGRATION WITH Apache::Status"
This package is designed to integrate with the \fBApache::Status\fR package that
is a part of mod_perl. However, this is not currently functional. When this
has been debugged, the details will be presented here.
.SH "CAVEATS"
.IX Header "CAVEATS"
This is the newest part of the RPC-XML package. While the package as a whole
is now considered beta, this piece may yet undergo some alpha-like
enhancements to the interface and such. However, the design and planning of
this were carefully considered, so any such changes should be minimal.
.SH "DIAGNOSTICS"
.IX Header "DIAGNOSTICS"
Diagnostics are not handled well in this module.
.SH "BUGS"
.IX Header "BUGS"
Please report any bugs or feature requests to
\&\f(CW\*(C`bug\-rpc\-xml at rt.cpan.org\*(C'\fR, or through the web interface at
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=RPC\-XML>. I will be
notified, and then you'll automatically be notified of progress on
your bug as I make changes.
.SH "SUPPORT"
.IX Header "SUPPORT"
.IP "\(bu" 4
\&\s-1RT: CPAN\s0's request tracker
.Sp
<http://rt.cpan.org/NoAuth/Bugs.html?Dist=RPC\-XML>
.IP "\(bu" 4
AnnoCPAN: Annotated \s-1CPAN\s0 documentation
.Sp
<http://annocpan.org/dist/RPC\-XML>
.IP "\(bu" 4
\&\s-1CPAN\s0 Ratings
.Sp
<http://cpanratings.perl.org/d/RPC\-XML>
.IP "\(bu" 4
Search \s-1CPAN\s0
.Sp
<http://search.cpan.org/dist/RPC\-XML>
.IP "\(bu" 4
MetaCPAN
.Sp
<https://metacpan.org/release/RPC\-XML>
.IP "\(bu" 4
Source code on GitHub
.Sp
<http://github.com/rjray/rpc\-xml>
.SH "LICENSE AND COPYRIGHT"
.IX Header "LICENSE AND COPYRIGHT"
This file and the code within are copyright (c) 2011 by Randy J. Ray.
.PP
Copying and distribution are permitted under the terms of the Artistic
License 2.0 (<http://www.opensource.org/licenses/artistic\-license\-2.0.php>) or
the \s-1GNU LGPL 2.1\s0 (<http://www.opensource.org/licenses/lgpl\-2.1.php>).
.SH "CREDITS"
.IX Header "CREDITS"
The \fBXML-RPC\fR standard is Copyright (c) 1998\-2001, UserLand Software, Inc.
See <http://www.xmlrpc.com> for more information about the \fBXML-RPC\fR
specification.
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Apache::Status, Apache::RPC::Server,
RPC::XML::Method
.SH "AUTHOR"
.IX Header "AUTHOR"
Randy J. Ray \f(CW\*(C`<rjray@blackperl.com>\*(C'\fR