.\" 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 "Net::xAP 3pm" .TH Net::xAP 3pm "2022-11-19" "perl v5.36.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" Net::xAP \- A base class for protocols such as IMAP, ACAP, IMSP, and ICAP. .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\f(CW\*(C`use Net::xAP;\*(C'\fR .PP \&\fB\s-1WARNING:\s0 This code is in alpha release. Expect the interface to change from release to release.\fR .SH "DESCRIPTION" .IX Header "DESCRIPTION" This base class implements the substrate common across the \s-1IMAP, ACAP, IMSP,\s0 and \s-1ICAP\s0 protocols. It provides the interface to the network calls and implements a small amount of glue to assist in implementing interfaces to this protocol family. .SH "END-PROGRAMMER METHODS" .IX Header "END-PROGRAMMER METHODS" The following methods are potentially useful for end-programmers. .SS "last_command_time" .IX Subsection "last_command_time" Return what time the most recent command was sent to the server. The return value is a \f(CW\*(C`time\*(C'\fR integer. .SS "connection" .IX Subsection "connection" Returns the connection object being used by the object. .SH "PROTOCOL-DEVELOPER METHODS" .IX Header "PROTOCOL-DEVELOPER METHODS" The following methods are probably only useful to protocol developers. .ie n .SS "new $host, $peerport [, %options]" .el .SS "new \f(CW$host\fP, \f(CW$peerport\fP [, \f(CW%options\fP]" .IX Subsection "new $host, $peerport [, %options]" Create a new instance of Net::xAP, connects to \f(CW$host\fR, and returns a reference to the object. .PP The \f(CW$host\fR parameter is the name of the host to contact. If \&\f(CW$host\fR starts with a \f(CW\*(C`/\*(C'\fR character, the parameter is assumed to contain the name of a program and the given program is spawned as a child process. This is useful for driving programs that can be operated interactively from the command-line, such as UW-imapd. .PP The \f(CW$peerport\fR parameter specifies the \s-1TCP\s0 port used for the network connection. The parameter should be in the syntax understood by \&\f(CW\*(C`IO::Socket::INET\->new\*(C'\fR. This parameter is ignored if a child process is spawned. .PP The \f(CW%options\fR parameter specifies any options to use. The following list enumerates the options, and their default values, currently understood by \f(CW\*(C`Net::xAP\*(C'\fR: .ie n .IP """Synchronous => 1""" 4 .el .IP "\f(CWSynchronous => 1\fR" 4 .IX Item "Synchronous => 1" Setting this option causes \f(CW\*(C`Net::xAP\*(C'\fR to issue a \f(CW\*(C`response\*(C'\fR method immediately after sending the command to the server. Currently, this option should always be left on. Non-synchronous command/response processing has not been tested. .Sp One down-side to Synchronous mode is that commands cannot be sent to the server from within a callback. Instead, the results should be saved, and the commands should be sent after the current command has completed. .ie n .IP """NonSyncLits => 0""" 4 .el .IP "\f(CWNonSyncLits => 0\fR" 4 .IX Item "NonSyncLits => 0" Setting this option causes \f(CW\*(C`Net::xAP\*(C'\fR to use non-synchronizing literals. This should only be enabled if the protocol and server this feature. .ie n .IP """Debug => 0""" 4 .el .IP "\f(CWDebug => 0\fR" 4 .IX Item "Debug => 0" Setting this option causes debug output to be written to \f(CW\*(C`stderr\*(C'\fR. See the \f(CW\*(C`debug_print\*(C'\fR method for a description of the output format. .ie n .IP """InternetDraft => 0""" 4 .el .IP "\f(CWInternetDraft => 0\fR" 4 .IX Item "InternetDraft => 0" Setting this option adds support for various extensions that are still in Internet Draft. This option is only intended to be used by protocol developers. Most bug reports related to this feature will be ignored. .PP All options are also passed to the internal call to \&\f(CW\*(C`IO::Socket::INET\->new\*(C'\fR, unless a child \s-1IMAP\s0 process is spawned. .ie n .SS "command $callback, $command [, @args]" .el .SS "command \f(CW$callback\fP, \f(CW$command\fP [, \f(CW@args\fP]" .IX Subsection "command $callback, $command [, @args]" The \f(CW\*(C`command\*(C'\fR is used to send commands to the server. .PP The \f(CW$callback\fR parameter should be a reference to a subroutine. It will be called when a response is received from the server. .PP \&\f(CW@args\fR is a list of \f(CW$type\fR\-\f(CW$value\fR pairs. The \f(CW$type\fR indicates what type of data type to use for \f(CW$value\fR. This is used to control the encoding necessary to pass the command arguments to the server. .PP The following \f(CW$type\fRs are understood: .ie n .IP """ATOM""" 4 .el .IP "\f(CWATOM\fR" 4 .IX Item "ATOM" The data will sent raw to the server. .ie n .IP """ASTRING""" 4 .el .IP "\f(CWASTRING\fR" 4 .IX Item "ASTRING" The data will be sent to the server as an atom, a quoted string, or a literal depending on the content of \f(CW$value\fR. .ie n .IP """PARENS""" 4 .el .IP "\f(CWPARENS\fR" 4 .IX Item "PARENS" The data in \f(CW$value\fR will be interpreted as an array reference and be sent inside a pair of parentheses. .ie n .IP """STRING""" 4 .el .IP "\f(CWSTRING\fR" 4 .IX Item "STRING" The data will be sent to the server as either a quoted string or literal depending on the content of \f(CW$value\fR. .ie n .IP """QSTRING""" 4 .el .IP "\f(CWQSTRING\fR" 4 .IX Item "QSTRING" The data will be sent to the server as a quoted string. .PP If the \f(CW\*(C`Synchronous\*(C'\fR option is set this method will return a response object, otherwise it will return the sequence number associated with the command just sent to the server. .ie n .SS "parse_fields $str" .el .SS "parse_fields \f(CW$str\fP" .IX Subsection "parse_fields $str" Splits the specified \f(CW$str\fR into fields. A list reference is returned contain the individual fields. Parenthetical clauses are represented as nested list references of arbitrary depth. Quoted strings are stripped of their surrounding quotes and escaped \f(CW\*(C`\e\e\*(C'\fR and \&\f(CW\*(C`\e"\*(C'\fR characters are unescaped. .SS "response" .IX Subsection "response" Reads response lines from the server until one of the lines is a completion response. For each response, the appropriate callbacks are triggered. This is automatically called if the \f(CW\*(C`Synchronous\*(C'\fR option is on. .SS "getline" .IX Subsection "getline" Get one 'line' of data from the server, including any literal payloads. .SS "close_connection" .IX Subsection "close_connection" Closes the connection to the server, returning the results of the operation. .SS "sequence" .IX Subsection "sequence" Returns the sequence number of the last command issued to the server. .SS "next_sequence" .IX Subsection "next_sequence" Returns the sequence number that will be assigned to the next command issued. .SS "pending" .IX Subsection "pending" Returns a list of sequence numbers for the commands that are still awaiting a complete response from the server. .PP The list is sorted numerically. .SS "debug [$boolean]" .IX Subsection "debug [$boolean]" Returns the value of the debug option for the object. .PP If \f(CW$boolean\fR is specified, the debug state is set to the given value. .ie n .SS "debug_print $direction, $text" .el .SS "debug_print \f(CW$direction\fP, \f(CW$text\fP" .IX Subsection "debug_print $direction, $text" Prints \f(CW$text\fR to \f(CW\*(C`STDERR\*(C'\fR, preceded by an indication of traffic direction, the object reference, and a timestamp. The parameter \&\f(CW$direction\fR is used to indicate the direction of the traffic related to the debug call. Use \f(CW0\fR for data being sent to the server, or \&\f(CW1\fR for data coming from the server. .ie n .SS "debug_text $text" .el .SS "debug_text \f(CW$text\fP" .IX Subsection "debug_text $text" A stub method intended to be overridden by subclasses. It provides subclasses with the ability to make alterations to \f(CW$text\fR before being output by \f(CW\*(C`debug_print\*(C'\fR method. The base class version does no alteration of \f(CW$text\fR. .SH "RESPONSE OBJECTS" .IX Header "RESPONSE OBJECTS" A response object is the data type returned by the \f(CW\*(C`response\*(C'\fR method. A few convenience routines are provided at the Net::xAP level that are likely to be common across several protocols. .SS "new" .IX Subsection "new" Creates a new response object. .SS "tag" .IX Subsection "tag" Returns the tag associated with the response object. .SS "status" .IX Subsection "status" Returns the command status associated with the response object. This will be \f(CW\*(C`OK\*(C'\fR, \f(CW\*(C`NO\*(C'\fR, or \f(CW\*(C`BAD\*(C'\fR. .SS "text" .IX Subsection "text" Returns the human readable text associated with the status of the response object. .PP This will typically be overridden by a subclass of the \f(CW\*(C`xAP\*(C'\fR class to handle things like status codes. .SS "status_code" .IX Subsection "status_code" Returns a list reference containing the response code portion of the server response. .SH "CAVEATS" .IX Header "CAVEATS" With only a few exceptions, the methods provided in this class are intended for use by developers adding support for additional protocols. Don't muck with this level, unless you know what you're doing. .SH "AUTHOR" .IX Header "AUTHOR" Kevin Johnson <\fIkjj@pobox.com\fR> .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 1997\-1999 Kevin Johnson . .PP All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.