473,378 Members | 1,493 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Perl telnet looping problem

CJ
Can someone look at the code below and tell me whats going on?

Here is the problem. I can successfully telnet one of our routers and
successfully put in a command in the while statement, but when the loop goes
around a second time, it gives me:
"pattern match timed-out at c:\filename.pl line 21"

It can't get past the waitfor statement for a prompt the 2nd go around in
the loop.

Ideas??

================================================== ====

use Net::Telnet;
use constant PASS=>'password';

$i=6300;
$telnet = new Net::Telnet (Timeout=>25);

$ip='<IP ADDRESS HERE>';

$telnet->open($ip);
$telnet->waitfor('/assword: /');
$telnet->print(PASS);

while ($i < 6400) {

print "LOOPED!!!\n"; 'for troubleshooting purposes
$prompt = $telnet->waitfor('/> /');
print "MADE IT PAST PROMPT\n"; 'for troubleshooting purposes

$statement=('<command goes here>');

$telnet->cmd($statement);
print "PORT FILTER ADDED\n"; 'for troubleshooting
$i++;

}
$telnet->close;
Jul 19 '05 #1
0 7249

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lionel | last post by:
Hi all, I would like having more informations on how we could exchange informations and/or objects between PERL and JAVA. We have a Java programs that open, maintain and close telnet...
2
by: Vinay Gupta | last post by:
Hi, In a Perl to Tcl conversion project, I am planning to use the following Tcl extensions as a replacement for some Perl libraries. My development environment is Windows. Win32::OLE --> "DDE"...
2
by: Kai Thorsrud | last post by:
Hi I'm currently into converting a perl linux app into a .Net windows service. The application monitors our syslog log files to capture i.p adress changes on some of our routers having dynamic...
4
by: Patricia Mindanao | last post by:
I want to call cgi perl scripts on my web hosters server from my HTML web pages (on the the web hosters server too). It occurs sometimes (especially during development phase) that these cgi-perl...
1
by: perlxyo999 | last post by:
Hi , I have a problem doing manipulation (like split) in string comeing back from telnet commnd : $HOST = 'xxx'; $USER = 'yyy20'; $PASS = 'yyy-pass'; #$telnet = Net::Telnet->new($HOST);...
2
by: susinthaa | last post by:
Hi, How to use a solaris mount command in perl? I tried that telnet to the solaris machine. For that solaris machine, how can I give the username and password? use Net::Telnet; use...
2
by: johnyboy1230987 | last post by:
I am running my perl on linux trying to connect to window via telnet. How can I overcome the "Mode:" prompt? as you know when you telnet a window box you will be prompted with "Mode" I tried...
6
by: sherrygomindes | last post by:
Hi I have written a perl script using the Telnet module. I need to remotely login in from one windows XP machine to another XP machine. But i get errors which i can't figure out the reason....
9
by: ravimath | last post by:
Hi all , I have written script to view some router output , my script executes successfuly , but does'nt show any output, why ?, it always shows output as 1. use Net::Telnet; use Term::ReadKey;...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.