Well, Net::Telnet() has served me well, but I need it to go *much* faster than it already is.
My script connects to a Vax machine, and issues whatever commands are needed, but I find that Net::Telnet() is running until the command timeout, not until the matching prompt returns. This has made me force my commands to have 40-60 second timeouts in order to ensure none of my info gets cut off. Using some key placements of 'localtime' to record what happens when, the example below will run for 31, 31, and 56 seconds respectively, even if the command is brief and finishes in 10-15 seconds.
I'm desperate to get this trimmed down in time, but don't know enough of the code's workings on my own to do it.
I've posted a few lines below... if someone prefers to see what's happening.
$match = '/\[0c/';
$matchop = $match;
$hostname = 'silly.vax.machine';
$vax = new Net::Telnet(Prompt => $match);
$vax->errmode("return");
$vax->open($hostname);
#$vax->dump_log($dumplog);
$start = localtime();
$vax->login(Name => $login, Password => $password) || die "cannot logi
+n to $hostname";
$vax->cmd(String => $string1, Timeout => 30, Prompt => $matchop);
$vax->cmd(String => $string2, Timeout => 30, Prompt => $matchop);
$vax->cmd(String => $string3, Timeout => 55, Prompt => $matchop);
... you get the picture. Is there something I'm doing wrong or misinterpreting when reading the CPAN documentation about matching and timeouts?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.