From: Austin S. <te...@of...> - 2002-02-28 09:12:13
|
On Wed, Feb 27, 2002 at 03:05:25PM -0500, Sorrell, Al wrote: > Solaris 2.6 Expect 1.12 > In all the examples, when a timeout is encountered you simply die(); > In my case, a device can get into a state where what is returned is > unpredictable. There is a specific sequence that I can then send to log out > the previous action and get back to a known state. > However, the code below doesn't seem to work correctly > $exp->expect($timeout, > ['OVL111', sub { my $fh = shift; $fh->send("login\n"); }], > ['\.', sub { my $fh = shift; $fh->send("****\nlogo\n");exp_continue; > }], > [timeout => sub { my $fh = shift; > $fh->send("****\nlogo\n");exp_continue; }] > ); > Well first you have no guarantee that that you will get the whole string 'OVL111' all at once. It may be split up between two reads, which will break your code. Secondly, you may be expecting the literal '\.' rather than the regex, which may not be what you want. Perhaps you want something like '.{7,}' which would be a string longer than OVL111? It's rather difficult to tell from here what you are trying to accomplish. Have you tried setting $Expect::Exp_Internal to watch what your script is trying to find? Austin |