Subject: | Expect-1.32 matches differently than v1.21 |
Date: | Fri, 14 Nov 2014 23:04:56 +0100 |
To: | bug-Expect [...] rt.cpan.org |
From: | Heinz Knutzen <heinz.knutzen [...] gmail.com> |
I use Expect.pm to parse the output of Linux "iptables-save" command.
The output should be read up to the next prompt which matches "\n#".
But inside the output there are other occurences of "\n#".
Expect-1.21 only matched the backmost "\n#",
but Expect-1.32 matches the first one,
so I don't get the expected output in $e->before.
This test succeeds with Expect-1.21, but fails with Expect-1.32:
============================================
use strict;
use warnings;
use Test::More;
use Expect;
my $e = Expect->new;
$e->raw_pty(1);
$e->log_stdout(0);
$e->spawn($^X . q{ -e 'print "iptables-save\n# Generated
by\n*filter\n#";' });
$e->send("iptables-save\n");
$e->expect(1, '-re', '\n#$');
is $e->before, "iptables-save\n# Generated by\n*filter";
is $e->after, "";
done_testing;
============================================