This is probably good advice. In the past I think I've made expect work, but I've wasted enough time on it now that I could have just written some code to do it.



On Mon, Aug 20, 2018 at 1:31 PM, Craig Sanders via luv-main <luv-main@luv.asn.au> wrote:
On Mon, Aug 20, 2018 at 10:29:46AM +1000, cory seligman wrote:
> I'm having some trouble making expect work.

expect itself is a complete PITA.  IMO you are better off using one of the
expect-like modules for a general purpose programming language like perl
or python.

Also IMO, the time and effort you put into learning expect are better used
learning a general purpose language - expect has only one use which you'll
probably only need a few times in a decade at most, while perl or python or
whatever has any number of uses.

The only reason to use expect is because a) you are already an expert in it,
or b) you like tcl.  Everyone else should use their favourite programming
language.


Perl has several to choose from - the most generic is Expect.pm[1].  There's
also application-specific ones like Device::SerialPort[2]. or for specific
network protocols with, e.g., Net::SSH[3] and Net::Telnet[4].

Device::SerialPort has some basic expect-like functionality built in (e.g. the
"lookfor" method), or can be used with Expect.pm.

Python has Pexpect[5]

google for "yourlanguage expect" for other languages.


[1] https://metacpan.org/release/RGIERSIG/Expect-1.21
[2] https://metacpan.org/pod/Device::SerialPort
[3] https://metacpan.org/release/Net-SSH
[4] https://metacpan.org/release/Net-Telnet
[5] http://www.noah.org/wiki/Pexpect

craig

ps: i used to know expect.  I gave it up about 20 years ago when I first
discovered Net::Telnet and now use perl now whenever i need to do that sort of
thing.

--
craig sanders <cas@taz.net.au>
_______________________________________________
luv-main mailing list
luv-main@luv.asn.au
https://lists.luv.asn.au/cgi-bin/mailman/listinfo/luv-main