8.151. Net::CmdThe network command class, which is required by all of the modules under the libnet umbrella: Net::FTP, Net::SMTP, Net::POP3, etc. In addition, Net::Cmd can be inherited by a subclass of IO::Handle. Unless you are writing a new module that will become a part of libnet, Net::Cmd probably doesn't have any servicable parts that you'd be interested in, since these parts are already implemented in the underlying modules. This module is part of the core Perl distribution starting with Perl 5.8. Net::Cmd implements the following methods, which provide an interface to the Net::Cmd object.
code() Returns the three-digit code from the last command. If the last command is still pending, code returns 0.
dataend() Stops sending data to the remote server and ensures that a final CRLF has been sent.
datasend(data) Sends data to the remote server, converting LF to CRLF. data can be an array or reference to an array.
debug(level) Sets the debug level for the object. If you do not specify a value, then no debugging information will be provided. If you specify undef as the value, then the debug level will be determined by the debug level of the class.
message() Returns a text message from the last command.
ok() Returns nonzero if the last code value was greater than 0 and less than 400.
status() Returns the current status code and, if pending, returns CMD_PENDING. Net::Cmd implements the following class methods, which you should probably never touch at a user level.
command(command, [, args, ...]) Sends a command to the remote server. Returns undef on failure.
debug_print(dir, text) Outputs debugging information. dirrepresents data sent to the server, and text is the text that is sent.
debug_text(text) Prints debugging information.
getline() Retrieves one line, delimited by CRLF, from the remote server. Returns undef on failure.
parse_response(text) Returns an array of two values: the three-digit status code and a flag that is true when this is part of a multiline response. Called by response as a method with one argument.
read_until_dot() Reads data from the remote server until a line consisting of a single . is encountered. If the line matches .., one of the dots will be removed. Returns a reference to a list containing the lines or undef on failure.
response() Obtains a response from the server. On success, it returns the status code, or undef on failure.
tied_fh() Returns a filehandle tied to the Net::Cmd object. After you send a command, you can read from this filehandle with read() or from <>. Returns end-of-file when the final dot is encountered.
ungetline(text) Pushes back a line of text from the server.
unsupported() Sets the status code to 580 and the response to Unsupported command. Returns 0. Net::Cmd exports CMD_INFO, CMD_OK, CMD_MORE, CMD_REJECT, CMD_ERROR, and CMD_PENDING. Copyright © 2002 O'Reilly & Associates. All rights reserved. |
|