1 2 Net::Telnet, version 3.03 3 4 Copyright (c) 1997, 2000, 2002 Jay Rogers. All rights reserved. 5 This program is free software; you can redistribute it and/or 6 modify it under the same terms as Perl itself. 7 8 9 What's In It For You 10 -------------------- 11 12 . You'd like to communicate with another host or device via a 13 TELNET port and you'd like some specialized routines to help you 14 login and do other interactive things. 15 16 . You're not familiar with sockets and you want a simple way to 17 make client connections to TCP services. 18 19 . You want to be able to specify your own time-out while 20 connecting, reading, and writing. 21 22 . You're communicating with an interactive program at the other 23 end of some socket or pipe and you want to wait for certain 24 patterns to appear. 25 26 27 Archive Location 28 ---------------- 29 30 . In the CPAN directory: modules/by-module/Net/ 31 32 . To find a CPAN site near you see http://cpan.perl.org/SITES.html 33 34 35 Prerequisites 36 ------------- 37 38 . Perl Version 5.002 or later 39 40 . A MS-Windows machine requires Perl version 5.003_07 or later 41 42 . No other modules are required that don't already come with a 43 standard distribution of Perl. 44 45 46 Description 47 ----------- 48 49 Net::Telnet allows you to make client connections to a TCP port 50 and do network I/O, especially to a port using the TELNET 51 protocol. Simple I/O methods such as print, get, and getline are 52 provided. More sophisticated interactive features are provided 53 because connecting to a TELNET port ultimately means communicating 54 with a program designed for human interaction. These interactive 55 features include the ability to specify a timeout and to wait for 56 patterns to appear in the input stream, such as the prompt from a 57 shell. 58 59 Here's an example that prints who's logged-on to the remote host 60 sparky. In addition to a username and password, you must also 61 know the user's shell prompt, which for this example it's bash$ 62 63 use Net::Telnet (); 64 $t = new Net::Telnet (Timeout => 10, 65 Prompt => '/bash\$ $/'); 66 $t->open("sparky"); 67 $t->login($username, $passwd); 68 @lines = $t->cmd("who"); 69 print @lines; 70 71 See the user documentation for more examples. Also see the user 72 documentation for the section "What To Know Before Using". 73 74 Usage questions should be directed to the Usenet newsgroup 75 comp.lang.perl.modules. 76 77 Contact me, Jay Rogers <jay@rgrs.com>, if you find any bugs 78 or have suggestions for improvement. 79 80 81 Documentation 82 ------------- 83 84 User documentation in POD format is contained within the module 85 source (i.e. the .pm file). Installing using "make install" 86 places this documentation in a man page in the perl library under 87 the directory "man/man3". 88 89 To nicely format the documentation for printing, you may use 90 "groff" to convert to postscript. Groff is available under 91 the GNU General Public License (GPL) and is installed on most 92 Linux machines. 93 94 pod2man Net/Telnet.pm | groff -man -Tps > Net::Telnet.ps 95 96 97 Installation 98 ------------ 99 100 To install, cd to the directory containing the unpacked 101 distribution and do one of the following: 102 103 a. Create a makefile by running Makefile.PL using the perl 104 program into whose library you want to install and then run 105 make three times: 106 107 perl Makefile.PL 108 make 109 make test 110 make install 111 112 b. To install into a private library, for example your home 113 directory: 114 115 perl Makefile.PL \ 116 INSTALLSITELIB=$HOME/lib/perl \ 117 INSTALLMAN3DIR=$HOME/lib/perl/man/man3 118 make 119 make test 120 make pure_install 121 122 c. Alternatively, you can just copy or move Telnet.pm 123 from the distribution into a directory named Net/ in the Perl 124 library. You can then manually build the documentation using 125 pod2man or pod2html. 126 127-- 128Jay Rogers 129jay@rgrs.com 130July 16, 2002 131