|
|
|
Net::Telnet, version 3.00
|
|
|
|
Copyright (c) 1997 Jay Rogers. All rights reserved. This program
|
|
is free software; you can redistribute it and/or modify it under
|
|
the same terms as Perl itself.
|
|
|
|
Prerequisite
|
|
------------
|
|
|
|
. Perl Version 5.002 or later
|
|
|
|
. Windows 95/NT requires Perl beta version 5.003_07 or later
|
|
|
|
. No modules are required that don't already come with a
|
|
standard distribution of Perl.
|
|
|
|
Description
|
|
-----------
|
|
Net::Telnet allows you to make client connections to a TCP port
|
|
and do network I/O, especially with a port using the TELNET
|
|
protocol. Simple I/O methods such as print, get, and getline are
|
|
provided. More sophisticated interactive features are provided
|
|
because connecting to a TELNET port ultimately means communicating
|
|
with a program designed for human interaction. Some interactive
|
|
features include the ability to specify a timeout and to wait for
|
|
patterns to appear in the input stream, such as the prompt from a
|
|
command interpreter.
|
|
This example prints who's logged-on to the remote host sparky:
|
|
$sparky = new Net::Telnet (Host => "sparky",
|
|
Timeout => 10,
|
|
Prompt => '/[$%#>] $/');
|
|
$sparky->login($username, $passwd);
|
|
@lines = $sparky->cmd("/usr/bin/who");
|
|
print @lines;
|
|
$sparky->close;
|
|
Other reasons to use this class than strictly with a TELNET port
|
|
are:
|
|
|
|
. You're not familiar with sockets and you want a simple
|
|
way to make client connections to TCP services.
|
|
. You want to be able to specify your own time-out while
|
|
connecting, reading, or writing.
|
|
|
|
. You're communicating with an interactive program at the
|
|
other end of some socket or pipe and you want to wait for
|
|
certain patterns to appear.
|
|
|
|
Examples are contained in the POD user documentation.
|
|
|
|
This is an alpha version - meaning that the interface may change
|
|
in future versions. Contact me, Jay Rogers <jay@rgrs.com>, \
|
|
if you
|
|
find any bugs or have suggestions for improvement.
|
|
|
|
Documentation
|
|
-------------
|
|
|
|
User documentation in POD format is contained in the module.
|
|
Installing using "make" places a man page in the perl library
|
|
under directory "man/man3".
|
|
|
|
Installation
|
|
------------
|
|
|
|
. To install, cd to the directory containing the unpacked
|
|
distribution and do one of the following:
|
|
a. Create a makefile by running Makefile.PL using the perl
|
|
whose library you want to install into and then running
|
|
make:
|
|
perl Makefile.PL
|
|
make test
|
|
make install
|
|
b. To install into an alternate library, set the "prefix"
|
|
argument where you want to install. You can ignore any
|
|
errors mentioning perllocal.pod. For example:
|
|
perl Makefile.PL prefix=~/local
|
|
make test
|
|
make install
|
|
c. Alternatively, you can just copy or move Telnet.pm
|
|
from the distribution into a directory named Net in the
|
|
Perl library.
|
|
|
|
--
|
|
Jay Rogers
|
|
jay@rgrs.com
|
|
March 17, 1997
|