|
From: Blackstone, J. D. <jda...@ci...> - 2002-06-25 14:19:53
|
I just got bit by this, and I figure other people will too. (And I'm sure
I'll hit it again.)
So, remember, if you do this:
sub expectstuff # return 1 for success, 0 for failure
{
my($exp) = @_;
$exp->expect($timeout,
[$regex1 => sub { ... }],
[$regex2 => sub { ... }],
[$regex3 => # if we get this, we know it didn't work
sub { return 0 }],);
return 1;
}
then your "return 0" statement is useless. It's in an anonymous subroutine,
and that subroutine will return 0, but your expectstuff routine will still
return 1.
That seems obvious, but I came about this in a roundabout way, because
originally I had something like [$regex3 => sub { die "..." }], but I wanted
to change it so my program didn't die just for failing with one connection.
jdb
|