diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:43:11 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:43:11 +0000 |
commit | fc22b3d6507c6745911b9dfcc68f1e665ae13dbc (patch) | |
tree | ce1e3bce06471410239a6f41282e328770aa404a /upstream/mageia-cauldron/man3pm/Net::Cmd.3pm | |
parent | Initial commit. (diff) | |
download | manpages-l10n-fc22b3d6507c6745911b9dfcc68f1e665ae13dbc.tar.xz manpages-l10n-fc22b3d6507c6745911b9dfcc68f1e665ae13dbc.zip |
Adding upstream version 4.22.0.upstream/4.22.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'upstream/mageia-cauldron/man3pm/Net::Cmd.3pm')
-rw-r--r-- | upstream/mageia-cauldron/man3pm/Net::Cmd.3pm | 294 |
1 files changed, 294 insertions, 0 deletions
diff --git a/upstream/mageia-cauldron/man3pm/Net::Cmd.3pm b/upstream/mageia-cauldron/man3pm/Net::Cmd.3pm new file mode 100644 index 00000000..b41340d4 --- /dev/null +++ b/upstream/mageia-cauldron/man3pm/Net::Cmd.3pm @@ -0,0 +1,294 @@ +.\" -*- mode: troff; coding: utf-8 -*- +.\" Automatically generated by Pod::Man 5.01 (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 +.. +.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. +.ie n \{\ +. ds C` "" +. ds C' "" +'br\} +.el\{\ +. 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::Cmd 3pm" +.TH Net::Cmd 3pm 2023-11-28 "perl v5.38.2" "Perl Programmers Reference Guide" +.\" 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::Cmd \- Network Command class (as used by FTP, SMTP etc) +.SH SYNOPSIS +.IX Header "SYNOPSIS" +.Vb 1 +\& use Net::Cmd; +\& +\& @ISA = qw(Net::Cmd); +.Ve +.SH DESCRIPTION +.IX Header "DESCRIPTION" +\&\f(CW\*(C`Net::Cmd\*(C'\fR is a collection of methods that can be inherited by a sub-class +of \f(CW\*(C`IO::Socket::INET\*(C'\fR. These methods implement the functionality required for a +command based protocol, for example FTP and SMTP. +.PP +If your sub-class does not also derive from \f(CW\*(C`IO::Socket::INET\*(C'\fR or similar (e.g. +\&\f(CW\*(C`IO::Socket::IP\*(C'\fR, \f(CW\*(C`IO::Socket::INET6\*(C'\fR or \f(CW\*(C`IO::Socket::SSL\*(C'\fR) then you must +provide the following methods by other means yourself: \f(CWclose()\fR and +\&\f(CWtimeout()\fR. +.SS "Public Methods" +.IX Subsection "Public Methods" +These methods provide a user interface to the \f(CW\*(C`Net::Cmd\*(C'\fR object. +.ie n .IP debug($level) 4 +.el .IP \f(CWdebug($level)\fR 4 +.IX Item "debug($level)" +Set the level of debug information for this object. If \f(CW$level\fR is not given +then the current state is returned. Otherwise the state is changed to +\&\f(CW$level\fR and the previous state returned. +.Sp +Different packages +may implement different levels of debug but a non-zero value results in +copies of all commands and responses also being sent to STDERR. +.Sp +If \f(CW$level\fR is \f(CW\*(C`undef\*(C'\fR then the debug level will be set to the default +debug level for the class. +.Sp +This method can also be called as a \fIstatic\fR method to set/get the default +debug level for a given class. +.ie n .IP message() 4 +.el .IP \f(CWmessage()\fR 4 +.IX Item "message()" +Returns the text message returned from the last command. In a scalar +context it returns a single string, in a list context it will return +each line as a separate element. (See "PSEUDO RESPONSES" below.) +.ie n .IP code() 4 +.el .IP \f(CWcode()\fR 4 +.IX Item "code()" +Returns the 3\-digit code from the last command. If a command is pending +then the value 0 is returned. (See "PSEUDO RESPONSES" below.) +.ie n .IP ok() 4 +.el .IP \f(CWok()\fR 4 +.IX Item "ok()" +Returns non-zero if the last code value was greater than zero and +less than 400. This holds true for most command servers. Servers +where this does not hold may override this method. +.ie n .IP status() 4 +.el .IP \f(CWstatus()\fR 4 +.IX Item "status()" +Returns the most significant digit of the current status code. If a command +is pending then \f(CW\*(C`CMD_PENDING\*(C'\fR is returned. +.ie n .IP datasend($data) 4 +.el .IP \f(CWdatasend($data)\fR 4 +.IX Item "datasend($data)" +Send data to the remote server, converting LF to CRLF. Any line starting +with a '.' will be prefixed with another '.'. +\&\f(CW$data\fR may be an array or a reference to an array. +The \f(CW$data\fR passed in must be encoded by the caller to octets of whatever +encoding is required, e.g. by using the Encode module's \f(CWencode()\fR function. +.ie n .IP dataend() 4 +.el .IP \f(CWdataend()\fR 4 +.IX Item "dataend()" +End the sending of data to the remote server. This is done by ensuring that +the data already sent ends with CRLF then sending '.CRLF' to end the +transmission. Once this data has been sent \f(CW\*(C`dataend\*(C'\fR calls \f(CW\*(C`response\*(C'\fR and +returns true if \f(CW\*(C`response\*(C'\fR returns CMD_OK. +.SS "Protected Methods" +.IX Subsection "Protected Methods" +These methods are not intended to be called by the user, but used or +over-ridden by a sub-class of \f(CW\*(C`Net::Cmd\*(C'\fR +.ie n .IP """debug_print($dir, $text)""" 4 +.el .IP "\f(CWdebug_print($dir, $text)\fR" 4 +.IX Item "debug_print($dir, $text)" +Print debugging information. \f(CW$dir\fR denotes the direction \fItrue\fR being +data being sent to the server. Calls \f(CW\*(C`debug_text\*(C'\fR before printing to +STDERR. +.ie n .IP """debug_text($dir, $text)""" 4 +.el .IP "\f(CWdebug_text($dir, $text)\fR" 4 +.IX Item "debug_text($dir, $text)" +This method is called to print debugging information. \f(CW$text\fR is +the text being sent. The method should return the text to be printed. +.Sp +This is primarily meant for the use of modules such as FTP where passwords +are sent, but we do not want to display them in the debugging information. +.ie n .IP """command($cmd[, $args, ... ])""" 4 +.el .IP "\f(CWcommand($cmd[, $args, ... ])\fR" 4 +.IX Item "command($cmd[, $args, ... ])" +Send a command to the command server. All arguments are first joined with +a space character and CRLF is appended, this string is then sent to the +command server. +.Sp +Returns undef upon failure. +.ie n .IP unsupported() 4 +.el .IP \f(CWunsupported()\fR 4 +.IX Item "unsupported()" +Sets the status code to 580 and the response text to 'Unsupported command'. +Returns zero. +.ie n .IP response() 4 +.el .IP \f(CWresponse()\fR 4 +.IX Item "response()" +Obtain a response from the server. Upon success the most significant digit +of the status code is returned. Upon failure, timeout etc., \fICMD_ERROR\fR is +returned. +.ie n .IP parse_response($text) 4 +.el .IP \f(CWparse_response($text)\fR 4 +.IX Item "parse_response($text)" +This method is called by \f(CW\*(C`response\*(C'\fR as a method with one argument. It should +return an array of 2 values, the 3\-digit status code and a flag which is true +when this is part of a multi-line response and this line is not the last. +.ie n .IP getline() 4 +.el .IP \f(CWgetline()\fR 4 +.IX Item "getline()" +Retrieve one line, delimited by CRLF, from the remote server. Returns \fIundef\fR +upon failure. +.Sp +\&\fBNOTE\fR: If you do use this method for any reason, please remember to add +some \f(CW\*(C`debug_print\*(C'\fR calls into your method. +.ie n .IP ungetline($text) 4 +.el .IP \f(CWungetline($text)\fR 4 +.IX Item "ungetline($text)" +Unget a line of text from the server. +.ie n .IP rawdatasend($data) 4 +.el .IP \f(CWrawdatasend($data)\fR 4 +.IX Item "rawdatasend($data)" +Send data to the remote server without performing any conversions. \f(CW$data\fR +is a scalar. +As with \f(CWdatasend()\fR, the \f(CW$data\fR passed in must be encoded by the caller +to octets of whatever encoding is required, e.g. by using the Encode module's +\&\f(CWencode()\fR function. +.ie n .IP read_until_dot() 4 +.el .IP \f(CWread_until_dot()\fR 4 +.IX Item "read_until_dot()" +Read data from the remote server until a line consisting of a single '.'. +Any lines starting with '..' will have one of the '.'s removed. +.Sp +Returns a reference to a list containing the lines, or \fIundef\fR upon failure. +.ie n .IP tied_fh() 4 +.el .IP \f(CWtied_fh()\fR 4 +.IX Item "tied_fh()" +Returns a filehandle tied to the Net::Cmd object. After issuing a +command, you may read from this filehandle using \fBread()\fR or <>. The +filehandle will return EOF when the final dot is encountered. +Similarly, you may write to the filehandle in order to send data to +the server after issuing a command that expects data to be written. +.Sp +See the Net::POP3 and Net::SMTP modules for examples of this. +.SS "Pseudo Responses" +.IX Subsection "Pseudo Responses" +Normally the values returned by \f(CWmessage()\fR and \f(CWcode()\fR are +obtained from the remote server, but in a few circumstances, as +detailed below, \f(CW\*(C`Net::Cmd\*(C'\fR will return values that it sets. You +can alter this behavior by overriding \fBDEF_REPLY_CODE()\fR to specify +a different default reply code, or overriding one of the specific +error handling methods below. +.IP "Initial value" 4 +.IX Item "Initial value" +Before any command has executed or if an unexpected error occurs +\&\f(CWcode()\fR will return "421" (temporary connection failure) and +\&\f(CWmessage()\fR will return undef. +.IP "Connection closed" 4 +.IX Item "Connection closed" +If the underlying \f(CW\*(C`IO::Handle\*(C'\fR is closed, or if there are +any read or write failures, the file handle will be forced closed, +and \f(CWcode()\fR will return "421" (temporary connection failure) +and \f(CWmessage()\fR will return "[$pkg] Connection closed" +(where \f(CW$pkg\fR is the name of the class that subclassed \f(CW\*(C`Net::Cmd\*(C'\fR). +The \fB_set_status_closed()\fR method can be overridden to set a different +message (by calling \fBset_status()\fR) or otherwise trap this error. +.IP Timeout 4 +.IX Item "Timeout" +If there is a read or write timeout \f(CWcode()\fR will return "421" +(temporary connection failure) and \f(CWmessage()\fR will return +"[$pkg] Timeout" (where \f(CW$pkg\fR is the name of the class +that subclassed \f(CW\*(C`Net::Cmd\*(C'\fR). The \fB_set_status_timeout()\fR method +can be overridden to set a different message (by calling \fBset_status()\fR) +or otherwise trap this error. +.SH EXPORTS +.IX Header "EXPORTS" +The following symbols are, or can be, exported by this module: +.IP "Default Exports" 4 +.IX Item "Default Exports" +\&\f(CW\*(C`CMD_INFO\*(C'\fR, +\&\f(CW\*(C`CMD_OK\*(C'\fR, +\&\f(CW\*(C`CMD_MORE\*(C'\fR, +\&\f(CW\*(C`CMD_REJECT\*(C'\fR, +\&\f(CW\*(C`CMD_ERROR\*(C'\fR, +\&\f(CW\*(C`CMD_PENDING\*(C'\fR. +.Sp +(These correspond to possible results of \f(CWresponse()\fR and \f(CWstatus()\fR.) +.IP "Optional Exports" 4 +.IX Item "Optional Exports" +\&\fINone\fR. +.IP "Export Tags" 4 +.IX Item "Export Tags" +\&\fINone\fR. +.SH "KNOWN BUGS" +.IX Header "KNOWN BUGS" +See <https://rt.cpan.org/Dist/Display.html?Status=Active&Queue=libnet>. +.SH AUTHOR +.IX Header "AUTHOR" +Graham Barr <gbarr@pobox.com <mailto:gbarr@pobox.com>>. +.PP +Steve Hay <shay@cpan.org <mailto:shay@cpan.org>> is now maintaining +libnet as of version 1.22_02. +.SH COPYRIGHT +.IX Header "COPYRIGHT" +Copyright (C) 1995\-2006 Graham Barr. All rights reserved. +.PP +Copyright (C) 2013\-2016, 2020, 2022 Steve Hay. All rights reserved. +.SH LICENCE +.IX Header "LICENCE" +This module is free software; you can redistribute it and/or modify it under the +same terms as Perl itself, i.e. under the terms of either the GNU General Public +License or the Artistic License, as specified in the \fILICENCE\fR file. +.SH VERSION +.IX Header "VERSION" +Version 3.15 +.SH DATE +.IX Header "DATE" +20 March 2023 +.SH HISTORY +.IX Header "HISTORY" +See the \fIChanges\fR file. |