-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
131 lines (92 loc) · 4.06 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
Net::Telnet, version 3.04
Copyright (c) 1997, 2000, 2002, 2013 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.
What's In It For You
--------------------
. You'd like to communicate with another host or device via a
TELNET port and you'd like some specialized routines to help you
login and do other interactive things.
. 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, and 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.
Archive Location
----------------
. In the CPAN directory: modules/by-module/Net/
. To find a CPAN site near you see http://cpan.perl.org/SITES.html
Prerequisites
-------------
. Perl Version 5.002 or later
. A MS-Windows machine requires Perl version 5.003_07 or later
. No other 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 to 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. These 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
shell.
Here's an example that prints who's logged-on to the remote host
sparky. In addition to a username and password, you must also
know the user's shell prompt, which for this example it's bash$
use Net::Telnet ();
$t = new Net::Telnet (Timeout => 10,
Prompt => '/bash\$ $/');
$t->open("sparky");
$t->login($username, $passwd);
@lines = $t->cmd("who");
print @lines;
See the user documentation for more examples. Also see the user
documentation for the section "What To Know Before Using".
Usage questions should be directed to the Usenet newsgroup
comp.lang.perl.modules.
Contact me, Jay Rogers <[email protected]>, if you find any bugs
or have suggestions for improvement.
Documentation
-------------
User documentation in POD format is contained within the module
source (i.e. the .pm file). Installing using "make install"
places this documentation in a man page in the perl library under
the directory "man/man3".
To nicely format the documentation for printing, you may use
"groff" to convert to postscript. Groff is available under
the GNU General Public License (GPL) and is installed on most
Linux machines.
pod2man Net/Telnet.pm | groff -man -Tps > Net::Telnet.ps
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
program into whose library you want to install and then run
make three times:
perl Makefile.PL
make
make test
make install
b. To install into a private library, for example your home
directory:
perl Makefile.PL \
INSTALLSITELIB=$HOME/lib/perl \
INSTALLMAN3DIR=$HOME/lib/perl/man/man3
make
make test
make pure_install
c. Alternatively, you can just copy or move Telnet.pm
from the distribution into a directory named Net/ in the Perl
library. You can then manually build the documentation using
pod2man or pod2html.
--
Jay Rogers
April 21, 2013