From: Roland G. <Rol...@al...> - 2000-11-21 12:09:55
|
Ken Irving wrote: > I saw a note on clpm mentioning Expect v1.08, so upgraded to it, but > I find that my scripts using v1.07 fail to work properly. I'm in the > process of tracking down the difficulty(/ies), and could let you know > what I find, if that would be helpful. Yes, that would be nice, so that I either can fix the incompatibilities or at least document them. Could you send me some short example script(s) that's failing now? Maybe I can spot obvious problems. I'm also trying to build up a basic testsuite, and backward-compatibility is important. > The Changes file says very little, only a mention of "multi-matching", > which I take to be multiline matching; the docs indicates that this > defaults to 1, so I tried changing it to 0, thinking this would revert > to v1.07 behavior, but my problems remain. No, the "multi-match" functionality is something else: you can now expect on several spawned programs at once. There is also a new callback interface that allows to write quite complex state machines in a single expect command. Take this example how to automate login: $obj->expect($timeout, [ qr'login: $', sub { my $fh = shift; print $fh "$username\r"; exp_continue; } ], [ 'Password: $', sub { my $fh = shift; print $fh "$password\r"; exp_continue; } ], [ timeout => sub { die "No login.\n"; } ], '-re', qr'[#>:] $', #' wait for shell prompt, then exit expect ); This is much more elegant than the old interface where you had to do a switch after the expect to see which pattern matched. > Perhaps it would be better to increment the version number by a bit more > than .01 to reflect the extent of changes made? In hindsight, this would have been better. > FWIW, I'm using Linux 2.2.5 system, and still using perl 5.005_02 (maybe > that's the problem?). No, I developed the new version with 5.00502, so that's OK. It's simply that the whole matching engine got twisted a lot, and this breaks backward compatibility. Hope this helps, Roland -- RGi...@cp... |