IO::Socket::CLI - CLI for IO::Socket::INET6 and IO::Socket::SSL
version 0.041
use IO::Socket::CLI; our @ISA = ("IO::Socket::CLI");
IO::Socket::CLI provides a command-line interface to IO::Socket::INET6 and IO::Socket::SSL.
IO::Socket::CLI
Creates a new IO::Socket::CLI object, returning its reference. Has the following options:
Hostname or IP address. Default is '127.0.0.1'.
'127.0.0.1'
Port of the service. Default is '143'.
'143'
Boolean value for if an SSL connection. Default is 0.
0
String server sends when it hangs up. Default is qr'^\* BYE( |\r?$)'.
qr'^\* BYE( |\r?$)'
Timeout in seconds for reading from the socket before returning an empty list. Default is 5.
5
Delay in milliseconds between read attempts if nothing is returned. Default is 10.
10
Boolean value for if to automatically print the server response on "read()". Default is 1.
1
Boolean value for if to pretend client commands and server responses with "C: " and "S: ", respectively. Default is 1.
"C: "
"S: "
Boolean value for if to give verbose debugging info. Default is 0.
Reads the response from the server, returning it as a list. Tries every DELAY milliseconds until TIMEOUT seconds. Optionally prints the response to STDOUT if PRINT_RESPONSE.
DELAY
TIMEOUT
STDOUT
PRINT_RESPONSE
Returns the last stored response from the server as a list.
Prints each line of server response to STDOUT, optionally prepending with "S: " if PREPEND.
PREPEND
Returns if the server hung up according to the last server response.
Sends $command to the server. Optionally echoes $command if PRINT_RESPONSE.
$command
Reads command from STDIN and sends it to the server.
STDIN
Returns last command sent.
Optionally turns PRINT_RESPONSE on/off. Returns value.
Optionally turns PREPEND on/off. Returns value.
Optionally sets TIMEOUT in seconds. Must be non-negative. Returns value.
Optionally sets DELAY in milliseconds. Must be positive. Returns value.
Optionally sets BYE. Must be a regexp-like quote: qr/STRING/. Returns value.
BYE
qr/STRING/
Optionally turns debugging info/verbosity on/off. Returns value.
Returns the underlying socket.
Returns errstr() from the socket. Only for SSL - returns undef otherwise.
errstr()
undef
Closes the socket. Returns true on success. This method needs to be overridden for SSL connections.
Does not verify SSL connections. Has not been tried with STARTTLS.
Copyright (C) 2012-2014 by Ashley Willis <ashley+perl@gitable.org>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.4 or, at your option, any later version of Perl 5 you may have available.
IO::Socket::INET6
IO::Socket::INET
IO::Socket::SSL
IO::Socket
To install IO::Socket::CLI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm IO::Socket::CLI
CPAN shell
perl -MCPAN -e shell install IO::Socket::CLI
For more information on module installation, please visit the detailed CPAN module installation guide.