From 6cd1ac44ea7af795055c80b6fbeb110646e9c1d5 Mon Sep 17 00:00:00 2001 From: Guillaume Rousse <guillaume.rousse@renater.fr> Date: Tue, 7 Nov 2017 15:02:15 +0100 Subject: [PATCH] use List::MoreUtils::any --- lib/IdPAccountManager/Data/ServiceProvider.pm | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/IdPAccountManager/Data/ServiceProvider.pm b/lib/IdPAccountManager/Data/ServiceProvider.pm index b94cee7..5672d41 100644 --- a/lib/IdPAccountManager/Data/ServiceProvider.pm +++ b/lib/IdPAccountManager/Data/ServiceProvider.pm @@ -5,6 +5,8 @@ use warnings; use base 'IdPAccountManager::DB::Object'; +use List::MoreUtils qw(any); + __PACKAGE__->meta->setup( table => 'serviceproviders', @@ -33,17 +35,13 @@ sub print { join(',', $self->contacts()); } -## Check if email address is a known contact (or conf.dev_sp_contact) +## Check if email address is a known contact sub is_contact { my ($self, $email) = @_; $email = lc($email); - foreach my $contact ($self->contacts()) { - return 1 if $email eq lc($contact); - } - - return 0; + return any { $email eq lc($_) } $self->contacts(); } 1; -- GitLab