Try something like:
$exp->send("atdt $number\r");
$exp->expect($timeout,
[ qr/CONNECT/],
[ qr/NO CARRIER/],
[ qr/ANSWER/],
[ qr/NODIALTONE/],
[ qr/BUSY/],
[ qr/ERROR/],
[ qr/PROTOCOL/],
[ qr/Password/],
[ qr/Login ID/],
[ qr/Cannot open/]
);
if ( ($exp->match() =~ m/NO CONNECT/) ||
($exp->match() =~ m/NO CARRIER/) ||
($exp->match() =~ m/ANSWER/) ||
($exp->match() =~ m/NODIALTONE/) ||
($exp->match() =~ m/BUSY/) ||
($exp->match() =~ m/ERROR/)
) {
print("\nCan't connect\n");
}
elsif ($exp->match() =~ m/CARRIER RX/) {
print("\nConnected...\n");
}
-----Original Message-----
From: avonnieda [mailto:ad...@vo...]
Sent: Friday, November 06, 2009 2:20 PM
To: exp...@li...
Subject: [Expectperl-discuss] How to make an expect string optional
Hi Folks,
I have one line in a program I'm automating that will prompt sometimes,
not always. How can I make an expect line "optional". In other words, ignore
this block if you don't see the string before the timeot is reached. Here's
the block I want to make optional.
$expect->expect($timeout,"Do you want to preserve the port number");
$expect->send("n\n");
Thanks very much for any insight.
-Adam
--
View this message in context:
http://old.nabble.com/How-to-make-an-expect-string-optional-tp26230867p26230
867.html
Sent from the Perl - Expectperl-Discuss mailing list archive at Nabble.com.
----------------------------------------------------------------------------
--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus
on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Expectperl-discuss mailing list
Exp...@li...
https://lists.sourceforge.net/lists/listinfo/expectperl-discuss
|