Subject: | Documentation example for waitfor() wrong |
The POD for the module shows this erroneous example near the end of the
SYNOPSIS section:
# check that we have the system prompt again.
my ($before_match, $match) = $ssh->waitfor('>\s*\z', 1); # waitfor() in
a list context
die "passwd failed. passwd said '$before_match'." unless ($match);
The waitfor() method only every returns a scalar, so the example is
wrong. The code comment (in Expect.pm) for the function is correct.
so the example in SYNOPSIS should be changed to:
# check that we have the system prompt again.
my $matched = $ssh->waitfor('>\s*\z', 1);
die 'passwd failed. passwd said ' . $ssh->before() unless $matched;