determine end of buffer

determine end of buffer

am 15.07.2005 15:10:07 von Nex_s

Hi All,

I've managed to create some script to log into a switch, retrieve a
report name and start that report. The buffer fills with data every 5
minutes. My problem is how to determine where the end of the buffer
is. Here is what the end of the buffer transfer looks like:


336 HCPOSTINGQTA
50
0 0

>

I've tried a waitfor command to look for the ">" bracket but for some
reason it only brings back half the buffer contents. Here's my code,
maybe I'm making this too hard.

Any help would be appreicated.



#!/usr/bin/perl
# file: ivr_dms.pl

use Net::Telnet;
$telnet = new Net::Telnet ( Timeout=>360
Errmode=>'die');
$telnet->open('123.456.789.10');
$telnet->waitfor('/\>$/i');
$telnet->print('user1');
$telnet->waitfor('/Enter Password$/i');
$telnet->print('*********');
$telnet->waitfor('/\>$/i');
$telnet->print('LOGUTIL');
$telnet->waitfor('/\>$/i');
$telnet->print("STOP");
sleep 2;
my ($output) = $telnet->waitfor('/\>$/i');
my $pos1 = index($output, '"');
my $pos2 = index (reverse ($output), '"') ;
my $reportname = (substr($output, $pos1+1, $pos2+1));
$telnet->print('addrep ' . $reportname . ' ompr 225');
sleep 2;
print "***** Report " . $reportname . " Added Successfully *****\n";
sleep 2;
$telnet->waitfor('/\>$/i');
$telnet->print("START");
my @lines = $telnet->waitfor('/\>$/i'); # this prints out the switch
reponse
print @lines;

# this waits for the buffer to fill and retrieves the data
my @datastream = $telnet->waitfor('/\>$/i');
print @datastream;