Subject: | Expect bug - first pattern lost when specifying options |
Date: | Thu, 02 Apr 2009 16:06:07 -0400 |
To: | bug-expect [...] rt.cpan.org |
From: | David Hester <dhester [...] yahoo-inc.com> |
example:
echo -e "\n\nfirst\nfirst\nsecond\nthird" | perl -e 'use strict;use Expect;my
$exp = Expect->exp_init(\*STDIN);$exp->expect("10","-re",[qr/first/i, sub {print
"found first\n";exp_continue;}], [qr/second/i, sub {print "found
second\n";exp_continue;}], [qr/third/i, sub {print "found
third\n";exp_continue;}]);'
prints:
found second
found third
remove the "-re" option and it finds the "first" pattern:
echo -e "\n\nfirst\nfirst\nsecond\nthird" | perl -e 'use strict;use Expect;my
$exp = Expect->exp_init(\*STDIN);$exp->expect("10",[qr/first/i, sub {print
"found first\n";exp_continue;}], [qr/second/i, sub {print "found
second\n";exp_continue;}], [qr/third/i, sub {print "found
third\n";exp_continue;}]);'
prints:
found first
found first
found second
found third
Thanks,
David Hester