From: Roland G. <rgi...@cp...> - 2009-11-10 10:02:51
|
Use a multi-expect with callback and exp_continue: $expect->expect($timeout, [ qr/Do you want to preserve the port number/ , sub { my $self = shift; $self->send("n\n"); exp_continue; }], [ qr/prompt>/, sub {}], ); See the man page for details. Hope this helps, Roland avonnieda schrieb: > 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 > > > |