|go ahead... be a heretic|
A few questions regarding Expect.pm and possible alternativesby Anonymous Monk
|on May 23, 2013 at 13:01 UTC||Need Help??|
Anonymous Monk has asked for the
wisdom of the Perl Monks concerning the following question:
Good morning Monks!
I have a few questions for you guys, so not really too sure how to title this one... I am using Expect to automate some things over here. Some of these things are simple commands, so Expect is not really necessary per se (i.e., I won't be using expect/send functionality). Others are interactive, so I will be needing Expect.
My first question is: Expect is a rather old Perl module that has not been updated in quite some time. Is this still the go-to module for automating interactive tasks via ssh, or is there something better?
Second, since I am running some commands that I only care to get the output from, and others that are interactive (i.e., where I am using expect/send), do you think it makes sense to use Net::SSH::Perl for the tasks where I need output, and Expect for those tasks that are interactive?
Finally, the commands I am running share output, have their own output, and have quite a bit of output. I could do this:
For each and every pattern... However, say with commandA I am expecting 40 or so different possible patterns, and with commandB I am expecting 30 or so possible patterns, 20 of which I am also expecting from commandA (i.e., shared possible patterns, union). Is there an easier way to do this then? Say something like a dispatch table where output is mapped to what to do, then I could do something like:
Or, maybe I could even have an XML file with all the possible outputs and what to dos defined? Just wondering how some of you would tackle this one, because my mind is drawing a blank.Thank you Monks!