Browse files

Fix problem with lookup_exclude discovered by Andrew Baerg, which

will cause display() to return prematurely.
  • Loading branch information...
1 parent ce8ce40 commit b20a7189552e0c6697b4ac3bcb52c2fc156fa92f Mike Heins committed Mar 4, 2011
Showing with 5 additions and 11 deletions.
  1. +5 −11 lib/Vend/Form.pm
View
16 lib/Vend/Form.pm
@@ -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}) {

0 comments on commit b20a718

Please sign in to comment.