blib/lib/Mo/utils/Email.pm

filter: Statementstmt 83.3% 10 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 87.5% 14 / 16 CC 1 SCAR 0.7
CC
1
Cov
83%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
↑ Summary
1 package Mo::utils::Email;
2  
3 2 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 0 ▶use Email::Valid;
Subroutine BEGIN: called CC=1 SCAR=2.6
8 use Error::Pure qw(err);
9 use Readonly;
10  
11 Readonly::Array our @EXPORT_OK => qw(check_email);
12  
13 our $VERSION = 0.02;
14  
15 sub check_email {
16 my ($self, $key) = @_;
17  
18 if (! exists $self->{$key}) {
19 return;
20 }
21  
22 my $address = Email::Valid->address($self->{$key});
23 if (! $address) {
24 err "Parameter '".$key."' doesn't contain valid email.",
25 'Value', $self->{$key},
26 ;
27 }
28  
29 return;
30 }
31  
32 1;
33  
34 __END__
↑ Summary