sonicscott9041 has asked for the wisdom of the Perl Monks concerning the following question:
Thanks in advance for any tips or suggestions.#!/usr/bin/perl my ($t, $op1, $op2); use Net::Telnet (); $t = new Net::Telnet; $t->open("192.168.1.1"); ## Open data file for writing open (nvfile, '>testout.txt'); ## Wait for first prompt and respond with 'era'. $t->waitfor('/login:/'); $t->print("era"); ## Wait for login prompt. $t->waitfor('/USER ID/'); $t->print("ANYUSER"); $t->print("ANYPASS"); ## Navigate to the report screen and select report to run. $t->waitfor('/SELECTION/'); $t->print("77"); $t->print("1"); $t->print("4"); $t->print("6910"); $t->print("?"); $t->print("10"); ## Run report On-screen and capture to file $t->print("O"); ($op1) = $t->waitfor('/Press any key to continue/'); print nvfile $op1; $t->print("N"); ($op2) = $t->waitfor('/REPORT COMPLETE/'); print nvfile $op2; $t->print(""); $t->print("END"); ## Logoff $t->waitfor('/SELECTION/'); $t->print("88"); $t->print("Y"); exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::Telnet / file question
by Illuminatus (Curate) on Jul 21, 2009 at 17:02 UTC | |
by sonicscott9041 (Novice) on Jul 21, 2009 at 19:32 UTC | |
by Illuminatus (Curate) on Jul 21, 2009 at 20:16 UTC | |
by sonicscott9041 (Novice) on Jul 21, 2009 at 21:17 UTC |