diff options
Diffstat (limited to 'xt/lib/QA/Util.pm')
-rw-r--r-- | xt/lib/QA/Util.pm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/xt/lib/QA/Util.pm b/xt/lib/QA/Util.pm index 90a6902e5..eb68a0b5b 100644 --- a/xt/lib/QA/Util.pm +++ b/xt/lib/QA/Util.pm @@ -18,6 +18,7 @@ use lib "$RealBin/../../lib", "$RealBin/../../../local/lib/perl5"; use autodie; use Data::Dumper; +use Email::Address; use Test::More; use parent qw(Exporter); @@ -25,6 +26,7 @@ use parent qw(Exporter); trim url_quote random_string + email_filter log_in logout @@ -367,6 +369,18 @@ sub set_parameters { } } +sub email_filter { + my ($toencode) = @_; + my @emails = Email::Address->parse($toencode); + if (scalar @emails) { + my @hosts = map { quotemeta($_->host) } @emails; + my $hosts_re = join('|', @hosts); + $toencode =~ s/\@(?:$hosts_re)//g; + return $toencode; + } + return $toencode; +} + 1; __END__ |