Skip to content

Commit f197bcd

Browse files
committed
allow email_get_containing to use similar to instead of like
Lets you do a bit more subtle matching
1 parent 10fbd9a commit f197bcd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

perllib/mySociety/WebTestHarness.pm

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ email is returned with any quoted printable characters decoded.
670670
671671
=cut
672672
sub email_get_containing($$) {
673-
my ($self, $check) = @_;
673+
my ($self, $check, $regex) = @_;
674674

675675
die "STRING must be scalar or array" if (ref($check) ne 'ARRAY' && ref($check) ne '');
676676
$check = [ $check ] if (ref($check) eq '');
@@ -688,7 +688,8 @@ sub email_get_containing($$) {
688688
my $quoted_c = encode_qp($c, "");
689689
push @params, $quoted_c;
690690
}
691-
$qfragment = join($bool, map { 'content like ?' } @params);
691+
my $match_op = defined $regex ? 'content similar to ?' : 'content like ?';
692+
$qfragment = join($bool, map { $match_op } @params);
692693
$qdesc = join($bool, map { "'$_'" } @params);
693694

694695
# Provoke any sending of mails

0 commit comments

Comments
 (0)