.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" 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 turned on, 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 .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "MAKE_METHOD 1p" .TH MAKE_METHOD 1p "2011-08-15" "perl v5.20.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" make_method \- Turn Perl code into an XML description for RPC::XML::Server .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& make_method \-\-name=system.identification \-\-helptext=\*(AqSystem ID string\*(Aq \& \-\-signature=string \-\-code=ident.pl \-\-output=ident.xpl \& \& make_method \-\-base=methods/identification .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is a simple tool to create the \s-1XML\s0 descriptive files for specifying methods to be published by an \fBRPC::XML::Server\fR\-based server. .PP If a server is written such that the methods it exports (or \fIpublishes\fR) are a part of the running code, then there is no need for this tool. However, in cases where the server may be separate and distinct from the code (such as an Apache-based \s-1RPC\s0 server), specifying the routines and filling in the supporting information can be cumbersome. .PP One solution that the \fBRPC::XML::Server\fR package offers is the means to load publishable code from an external file. The file is in a simple \s-1XML\s0 dialect that clearly delinates the externally-visible name, the method signatures, the help text and the code itself. These files may be created manually, or this tool may be used as an aide. .SH "REQUIRED ARGUMENTS" .IX Header "REQUIRED ARGUMENTS" There are no required arguments, but if there are not sufficient options passed you will be told by an error message. .SH "OPTIONS" .IX Header "OPTIONS" The tool recognizes the following options: .IP "\-\-help" 4 .IX Item "--help" Prints a short summary of the options. .IP "\-\-name=STRING" 4 .IX Item "--name=STRING" Specifies the published name of the method being encoded. This is the name by which it will be visible to clients of the server. .IP "\-\-namespace=STRING" 4 .IX Item "--namespace=STRING" Specifies a namespace that the code of the method will be evaluated in, when the \s-1XPL\s0 file is loaded by a server instance. .IP "\-\-type=STRING" 4 .IX Item "--type=STRING" Specify the type for the resulting file. \*(L"Type\*(R" here refers to whether the container tag used in the resulting \s-1XML\s0 will specify a \fBprocedure\fR or a \&\fBmethod\fR. The default is \fBmethod\fR. The string is treated case-independant, and only the first character (\f(CW\*(C`m\*(C'\fR or \f(CW\*(C`p\*(C'\fR) is actually regarded. .IP "\-\-version=STRING" 4 .IX Item "--version=STRING" Specify a version stamp for the code routine. .IP "\-\-hidden" 4 .IX Item "--hidden" If this is passe, the resulting file will include a tag that tells the server daemon to not make the routine visible through any introspection interfaces. .IP "\-\-signature=STRING [ \-\-signature=STRING ... ]" 4 .IX Item "--signature=STRING [ --signature=STRING ... ]" Specify one or more signatures for the method. Signatures should be the type names as laid out in the documentation in \s-1RPC::XML\s0, with the elements separated by a colon. You may also separate them with spaces, if you quote the argument. This option may be specified more than once, as some methods may have several signatures. .IP "\-\-helptext=STRING" 4 .IX Item "--helptext=STRING" Specify the help text for the method as a simple string on the command line. Not suited for terribly long help strings. .IP "\-\-helpfile=FILE" 4 .IX Item "--helpfile=FILE" Read the help text for the method from the file specified. .IP "\-\-code=FILE" 4 .IX Item "--code=FILE" Read the actual code for the routine from the file specified. If this option is not given, the code is read from the standard input file descriptor. .IP "\-\-output=FILE" 4 .IX Item "--output=FILE" Write the resulting \s-1XML\s0 representation to the specified file. If this option is not given, then the output goes to the standard output file descriptor. .IP "\-\-base=NAME" 4 .IX Item "--base=NAME" This is a special, \*(L"all-in-one\*(R" option. If passed, all other options are ignored. .Sp The value is used as the base element for reading information from a file named \fB\s-1BASE\s0\fR.base. This file will contain specification of the name, version, hidden status, signatures and other method information. Each line of the file should look like one of the following: .RS 4 .IP "\fBName: \f(BI\s-1STRING\s0\fB\fR" 4 .IX Item "Name: STRING" Specify the name of the routine being published. If this line does not appear, then the value of the \fB\-\-base\fR argument with all directory elements removed will be used. .IP "\fBVersion: \f(BI\s-1STRING\s0\fB\fR" 4 .IX Item "Version: STRING" Provide a version stamp for the function. If no line matching this pattern is present, no version tag will be written. .IP "\fBHidden: \f(BI\s-1STRING\s0\fB\fR" 4 .IX Item "Hidden: STRING" If present, \fI\s-1STRING\s0\fR should be either \f(CW\*(C`yes\*(C'\fR or \f(CW\*(C`no\*(C'\fR (case not important). If it is \f(CW\*(C`yes\*(C'\fR, then the method is marked to be hidden from any introspection \&\s-1API.\s0 .IP "\fBSignature: \f(BI\s-1STRING\s0\fB\fR" 4 .IX Item "Signature: STRING" This line may appear more than once, and is treated cumulatively. Other options override previous values if they appear more than once. The portion following the \f(CW\*(C`Signature:\*(C'\fR part is taken to be a published signature for the method, with elements separated by whitespace. Each method must have at least one signature, so a lack of any will cause an error. .IP "\fBHelpfile: \f(BI\s-1STRING\s0\fB\fR" 4 .IX Item "Helpfile: STRING" Specifies the file from which to read the help text. It is not an error if no help text is specified. .IP "\fBCodefile: \f(BI\s-1STRING\s0\fB\fR" 4 .IX Item "Codefile: STRING" Specifies the file from which to read the code. Code is assumed to be Perl, and will be tagged as such in the resulting file. .IP "\fBCodefile[lang]: \f(BIstring\fB\fR" 4 .IX Item "Codefile[lang]: string" Specifies the file from which to read code, while also identifying the language that the code is in. This allows for the creation of a \fB\s-1XPL\s0\fR file that includes multiple language implementations of the given method or procedure. .RE .RS 4 .Sp Any other lines than the above patterns are ignored. .Sp If no code has been read, then the tool will exit with an error message. .Sp The output is written to \fB\s-1BASE\s0\fR.xpl, preserving the path information so that the resulting file is right alongside the source files. This allows constructs such as: .Sp .Vb 1 \& make_method \-\-base=methods/introspection .Ve .RE .SH "FILE FORMAT AND DTD" .IX Header "FILE FORMAT AND DTD" The file format for these published routines is a very simple \s-1XML\s0 dialect. This is less due to \s-1XML\s0 being an ideal format than it is the availability of the parser, given that the \fBRPC::XML::Server\fR class will already have the parser code in core. Writing a completely new format would not have gained anything. .PP The Document Type Declaration for the format can be summarized by: .PP .Vb 10 \& \& \& \& \& \& \& \& \& \& \& .Ve .PP The file \f(CW\*(C`rpc\-method.dtd\*(C'\fR that comes with the distribution has some commentary in addition to the actual specification. .PP A file is (for now) limited to one definition. This is started by the one of the opening tags \f(CW\*(C`\*(C'\fR, \f(CW\*(C`\*(C'\fR or \&\f(CW\*(C`\*(C'\fR. This is followed by exactly one \f(CW\*(C`\*(C'\fR container specifying the method name, an optional version stamp, an optional hide-from-introspection flag, one or more \f(CW\*(C`\*(C'\fR containers specifying signatures, an optional \f(CW\*(C`\*(C'\fR container with the help text, then the \f(CW\*(C`\*(C'\fR container with the actual program code. All text should use entity encoding for the symbols: .PP .Vb 3 \& & C<&> (ampersand) \& E C<<> (less\-than) \& E C<>> (greater\-than) .Ve .PP The parsing process within the server class will decode the entities. To make things easier, the tool scans all text elements and encodes the above entities before writing the file. .SS "The Specification of Code" .IX Subsection "The Specification of Code" This is not \fI\*(L"Programming 101\*(R"\fR, nor is it \fI\*(L"Perl for the Somewhat Dim\*(R"\fR. The code that is passed in via one of the \f(CW\*(C`*.xpl\*(C'\fR files gets passed to \&\f(CW\*(C`eval\*(C'\fR with next to no modification (see below). Thus, badly-written or malicious code can very well wreak havoc on your server. This is not the fault of the server code. The price of the flexibility this system offers is the responsibility on the part of the developer to ensure that the code is tested and safe. .PP Code itself is treated as verbatim as possible. Some edits may occur on the server-side, as it make the code suitable for creating an anonymous subroutine from. The \fBmake_method\fR tool will attempt to use a \f(CW\*(C`CDATA\*(C'\fR section to embed the code within the \s-1XML\s0 document, so that there is no need to encode entities or such. This allows for the resulting \fI*.xpl\fR files to be syntax-testable with \f(CW\*(C`perl \-cx\*(C'\fR. You can aid this by ensuring that the code does not contain either of the two following character sequences: .PP .Vb 1 \& ]]> \& \& _\|_DATA_\|_ .Ve .PP The first is the \f(CW\*(C`CDATA\*(C'\fR terminator. If it occurs naturally in the code, it would trigger the end-of-section in the parser. The second is the familiar Perl token, which is inserted so that the remainder of the \s-1XML\s0 document does not clutter up the Perl parser. .SH "EXAMPLES" .IX Header "EXAMPLES" The \fB\s-1RPC::XML\s0\fR distribution comes with a number of default methods in a subdirectory called (cryptically enough) \f(CW\*(C`methods\*(C'\fR. Each of these is expressed as a set of (\f(CW\*(C`*.base\*(C'\fR, \f(CW\*(C`*.code\*(C'\fR, \f(CW\*(C`*.help\*(C'\fR) files. The Makefile.PL file configures the resulting Makefile such that these are used to create \&\f(CW\*(C`*.xpl\*(C'\fR files using this tool, and then install them. .SH "DIAGNOSTICS" .IX Header "DIAGNOSTICS" Most problems come out in the form of error messages followed by an abrupt exit. .SH "EXIT STATUS" .IX Header "EXIT STATUS" The tool exits with a status of 0 upon success, and 255 otherwise. .SH "CAVEATS" .IX Header "CAVEATS" I don't much like this approach to specifying the methods, but I liked my other ideas even less. .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 . 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 .IP "\(bu" 4 AnnoCPAN: Annotated \s-1CPAN\s0 documentation .Sp .IP "\(bu" 4 \&\s-1CPAN\s0 Ratings .Sp .IP "\(bu" 4 Search \s-1CPAN\s0 .Sp .IP "\(bu" 4 Source code on GitHub .Sp .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" This module and the code within are released under the terms of the Artistic License 2.0 (http://www.opensource.org/licenses/artistic\-license\-2.0.php). This code may be redistributed under either the Artistic License or the \s-1GNU\s0 Lesser General Public License (\s-1LGPL\s0) version 2.1 (http://www.opensource.org/licenses/lgpl\-2.1.php). .SH "SEE ALSO" .IX Header "SEE ALSO" \&\s-1RPC::XML\s0, RPC::XML::Server .SH "CREDITS" .IX Header "CREDITS" The \fBXML-RPC\fR standard is Copyright (c) 1998\-2001, UserLand Software, Inc. See for more information about the \fBXML-RPC\fR specification. .SH "AUTHOR" .IX Header "AUTHOR" Randy J. Ray