AOLserver::CtrlPort - Execute Commands on AOLserver's Control Port
use AOLserver::CtrlPort; my $conn = AOLserver::CtrlPort->new( Host => 'myhost', Port => 3456, User => 'username', Password => 'password', ); my $out = $conn->send_cmds(<<EOT); info tclversion EOT print $out, "\n";
AOLserver::CtrlPort uses Net::Telnet to connect to a running AOLserver's control port, issues commands there and returns the output.
AOLserver::CtrlPort
Net::Telnet
It is useful for creating test suites for AOLserver applications which can be controlled via the control port.
To configure AOLserver's control port, use settings similar to the following ones:
ns_section "ns/server/${servername}/module/nscp" ns_param address myhostname ns_param port 3334 ns_param echopassword 1 ns_param cpcmdlogging 1 ns_section "ns/server/${servername}/module/nscp/users" ns_param user "username:3G5/H31peci.o:" # That's "username:password" ns_section "ns/server/${servername}/modules" ns_param nscp ${bindir}/nscp.so
This lets AOLserver enable the control port on server myhostname on port 3334. Authentication is on, the username is username and the password is password (hashed to 3G5/H31peci.o with a program like htpasswd).
myhostname
username
password
3G5/H31peci.o
htpasswd
Creates a new control port client object. The following options are available to the constructor:
The port AOLserver is listening to for control port commands.
The control port address as defined in the configuration.
address
Number of seconds after which the client will time out if the server doesn't send a response.
User name for control port login defaults to the empty string for non-protected control ports.
Password for control port login defaults to the empty string for non-protected control ports.
Send one or more commands, separated by newlines, AOLserver's control port. The method will return the server's response as a string. Typically, this will look like
$out = $conn->send_cmds(<<EOT); info tclversion info commands EOT
and return the newline-separated response as a single string.
AOLserver::CtrlPort is Log4perl enabled. If your scripts don't do what you want and you need to find out which messages are being sent back and forth, you can easily bump up AOLserver::CtrlPort's internal debugging level by saying something like
use Log::Log4perl qw(:easy); Log::Log4perl->easy_init($DEBUG);
in your test script before any AOLserver::CtrlPort commands are called.
Please check out the Log::Log4perl documentation for details.
Mike Schilli, 2004, m@perlmeister.com
To install AOLserver::CtrlPort, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AOLserver::CtrlPort
CPAN shell
perl -MCPAN -e shell install AOLserver::CtrlPort
For more information on module installation, please visit the detailed CPAN module installation guide.