Skip to content

Commit

Permalink
Fix problem with lookup_exclude discovered by Andrew Baerg, which
Browse files Browse the repository at this point in the history
will cause display() to return prematurely.
  • Loading branch information
Mike Heins committed Mar 4, 2011
1 parent ce8ce40 commit b20a718
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions lib/Vend/Form.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1272,24 +1272,18 @@ if($opt->{debug}) {
$ary = [['', errmsg('--no current values--')]];
}
if($opt->{lookup_exclude}) {
my $sub;
my $re;
eval {
$sub = sub { $_[0] !~ m{$opt->{lookup_exclude}} };
$re = qr/$opt->{lookup_exclude}/;
};
if ($@) {
logError(
"Bad lookup pattern m{%s}: %s", $opt->{lookup_exclude}, $@,
);
undef $sub;
}
if($sub) {
@$data = grep $_,
map {
$sub->(join '=', @$_)
or return undef;
return $_;
} @$data;
undef $re;
}

$re and @$data = grep "$_->[0]=$_->[1]" !~ /$re/, @$data;
}

unless($opt->{lookup_merge}) {
Expand Down

0 comments on commit b20a718

Please sign in to comment.