[comp.unix.shell] Using PERL to control telnet session?

dwb@hare.cdc.com (dw block x-4621) (05/06/91)

Can I use PERL to control interactive programs such as telnet and ftp.  What I
am really looking for is a scripting capability similar to what you find in 
PC communications packages like crosstalk and procomm.  Send a command and
wait until you get some output back.  Then send another command (which could
be conditional on what kind of output you got back).

If this can be done in PERL, are there any example PERL scripts that show
how to do it?


------------------------------------------------------------
Dave Block                    E-mail:  dwb@hare.udev.cdc.com
Control Data Corp.            AT&T:    (612) 482-4621

mstgil@sol (Marc Ph. A. J. St.-Gil) (05/07/91)

You are looking for a perl program called chat2.

Try poking about in comp.lang.perl newsgroup.  Perhaps you should
re-post this there?

Cheers
--
Marc St.-Gil, UNIX Systems Administrator   mstgil@{sol,vaxa,vaxb}.acs.unt.edu
 University of North Texas  817/565-2324   mstgil@{ponder,solo}.csci.unt.edu
 Academic Computing Services   DISCLAIMER: My employers had no idea I was
 PO Box 13495, Denton TX, 76203            going to say that.

jik@athena.mit.edu (Jonathan I. Kamens) (05/07/91)

In article <32922@shamash.cdc.com>, dwb@hare.cdc.com (dw block x-4621) writes:
|> Can I use PERL to control interactive programs such as telnet and ftp.  What I
|> am really looking for is a scripting capability similar to what you find in 
|> PC communications packages like crosstalk and procomm.  Send a command and
|> wait until you get some output back.  Then send another command (which could
|> be conditional on what kind of output you got back).

In article <mstgil.673591467@sol>, mstgil@sol (Marc Ph. A. J. St.-Gil) writes:
|> You are looking for a perl program called chat2.

  Another option is the "expect" package, by Don Libes, available at an
archive site near you.  "Expect" was specifically designed to handle this
problem.

  Of course, I believe someone reimplemented "expect" in perl, and released a
version of that in alt.sources as well, so you might want to check the
alt.sources archives.

-- 
Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8085			      Home: 617-782-0710