The 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.
Returns the three-digit code from the last command. If the last command is still pending, code returns 0.
Stops sending data to the remote server and ensures that a final CRLF has been sent.
Sends data to the remote server, converting LF to CRLF. data can be an array or reference to an array.
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.
Returns a text message from the last command.
Returns nonzero if the last code value was greater than 0 and less than 400.
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.
Outputs debugging information. dirrepresents data sent to the server, and text is the text that is sent.
Prints debugging information.
Retrieves one line, delimited by CRLF, from the remote server. Returns undef on failure.
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.
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.
Obtains a response from the server. On success, it returns the status code, or undef on failure.
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.
Pushes back a line of text from the server.
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.