From: Heidi Ng <ng_...@ya...> - 2002-07-31 21:49:01
|
I double checked my script and tried using the expcet object. The following are 2 cases I tried. The first one is one without '-i'. When using this method, everything works fine. I turned on exp_internal and saw that expect actually sent and got a match. However, when I used the 2nd method with the '-i', the match field is blank. ($expect_arg: OK, $timeout: 120) 1) $temp = $session->expect( $timeout, ['-re', $expect_arg], ['timeout', sub {print "TIMEOUT expecting $expect_arg\n"}]); 2) $temp = $session->expect( $timeout, '-i', [$session], ['-re', $expect_arg], ['timeout', sub {print "TIMEOUT expecting $expect_arg\n"}] ); ------------------------------------------------------------------------------------------------------------------ Here's the exp_internal for the 1) and 2) case.... is my syntax wrong? ------------------------------------------------------------------------------------------------------------------ Starting EXPECT pattern matching... Expect::expect('Expect=GLOB(0xa863a8c)', 120, 'ARRAY(0xa869b58)', 'ARRAY (0xa86ec50)') called at VQT_utils.pl line 196 main::expMatch('Expect=GLOB(0xa863a8c)', 1008, 'reset', 'OK') called at VQT_abacus.pl line 141 main::abacusReset('Expect=GLOB(0xa863a8c)', 1008) called at VQT_abacus.p l line 264 main::abacusRun('Expect=GLOB(0xa863a8c)', 1008, 'C:\\Abacus5.11\\BIN', ' reset n id(6): Does ` \033[13;1H\033[0m spawn id(6): Does ` \033[13;1H\033[0m OK spawn id(6): Does ` \033[13;1H\033[0m \ 033[13;1H\033[0mreset\r\033[13;1H\033[0mr \033[13;1H\033[0mre \033[13;1H\033[0mres \033[1 3;1H\033[0mrese \033[13;5H\033[0m\033[13;1H\033[0mreset \033[14;1H\033[0m \033[14;1H\033[0m\ 033[14;1H\033[0mOK \033[15;1H\033[0m ' match: pattern #1: -re `OK'? YES!! Before match string: ` \033[13;1H\ 033[0m \033[13;1H\033[0mreset\r\033[13;1H\033[0mr \033[13;1H\033[0mre \033[13;1H\033[0 mres \033[13;1H\033[0mrese \033[13;5H\033[0m\033[13;1H\033[0mreset \033[14;1H\033[0m \033[14;1H\ 033[0m\033[14;1H\033[0m' Match string: `OK' After match string: ` \033[15;1H\033[0m ===================================================================================== Starting EXPECT pattern matching... Expect::expect('Expect=GLOB(0xa863a98)', 120, '-i', 'ARRAY(0xa869b64)', 'ARRAY(0xa869a50)', 'ARRAY(0xa869ad4)') called at VQT_utils.pl line 200 main::expMatch('Expect=GLOB(0xa863a98)', 884, 'reset', 'OK') called at V QT_abacus.pl line 141 main::abacusReset('Expect=GLOB(0xa863a98)', 884) called at VQT_abacus.pl line 264 main::abacusRun('Expect=GLOB(0xa863a98)', 884, 'C:\\Abacus5.11\\BIN', 'C :\DATA\VQT\Test_Results\1028151574', 'VQT_SIP_basic_short.env', 60, 1, 'SIP.phn' reset main::VQT_run(1) called at vqt_main.pl line 54 OK spawn id(6): Does ` \033[13;1H\033[0m \ 033[13;1H\033[0mreset\r\033[13;1H\033[0mr \033[13;1H\033[0mre \033[13;1H\033[0mres \033[1 3;1H\033[0mrese \033[13;5H\033[0m\033[13;1H\033[0mreset \033[14;1H\033[0m \033[14;1H\033[0m\ 033[14;1H\033[0mOK \033[15;1H\033[0m \033[15;1H\033[0m' match: ===================================================================================== ' Austin Schutz <te...@of...> wrote: On Wed, Jul 31, 2002 at 03:26:00PM -0500, Blackstone, J. David wrote: > I don't think you're supposed to use pids with -i; I think you're supposed > to use the Expect object itself. Otherwise, how would it get the object to > expect on? > That's right. I think the docs are clear on that point, but they seem a little vague that expect isn't supposed to be called as an object method: $object->expect($timeout, @match_patterns) or, more like Tcl/Expect, expect($timeout, '-i', [ $obj1, $obj2, ... ], [ $re_pattern, sub { ...; exp_continue; }, @subparms, [ 'eof', sub { ... } ], [ 'timeout', sub { ... }, \$subparm1 ], '-i', [ $objn, ...], '-ex', $exact_pattern, sub { ... }, $exact_pattern, sub { ...; exp_continue_timeout; }, '-re', $re_pattern, sub { ... }, '-i', \@object_list, @pattern_list, ...); which might imply something like $object->expect($timeout, '-i'...). Perhaps it would be clearer to have: Expect::expect($timeout, '-i', [ $obj1, $obj2, ... ], [ $re_pattern, sub { ...; exp_continue; }, @subparms, [ 'eof', sub { ... } ], [ 'timeout', sub { ... }, \$subparm1 ], '-i', [ $objn, ...], '-ex', $exact_pattern, sub { ... }, $exact_pattern, sub { ...; exp_continue_timeout; }, '-re', $re_pattern, sub { ... }, '-i', \@object_list, @pattern_list, ...); Austin --------------------------------- Do You Yahoo!? Yahoo! Health - Feel better, live better |