in reply to Automate remote console sessions.

One of my first perl projects involved a "screen scraper"- a telnet session to a mainframe application that was meant to be used interactively. Our program had to look for field names, see what if any text was highlighted, tab to the right place, enter data, get results from pages of tables, etc. And it was written in a perl4 variant- curseperl?- that was a long time ago. I wouldn't want to write it again without expect and heavy usage of CPAN.

I think expect is pretty good since it hides the tty details. But if you are only executing a few commands and they aren't text menu/field monsters, try the Net::SSH (uses your system's ssh) or Net::SSH::Perl (pure-perl SSH, no sys executable needed) modules. Haven't tried it myself but it looks like it's designed with that usage in mind.

Replies are listed 'Best First'.
Re^2: Automate remote console sessions.
by Yary (Pilgrim) on Jun 10, 2010 at 22:01 UTC
    I just re-read your question and realize I misunderstood it. Net::SSH probably won't help you much, and I can't think of anything better than the expect module offhand. Let's see what the monks have to say.