File Coverage

blib/lib/Type/EmailAddress.pm
Criterion Covered Total %
statement 18 18 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 24 24 100.0


line stmt bran cond sub pod time code
1             package Type::EmailAddress;
2             # ABSTRACT: type constraints for email addresses
3              
4 2     2   39281 use warnings;
  2         6  
  2         75  
5 2     2   12 use strict;
  2         5  
  2         68  
6 2     2   2034 use Email::Valid ();
  2         283278  
  2         68  
7 2     2   1794 use Type::Utils qw(declare as where inline_as);
  2         59104  
  2         31  
8 2     2   3939 use Types::Standard qw( Str );
  2         89766  
  2         31  
9             use Type::Library
10 2         15 -base,
11 2     2   2019 -declare => qw( EmailAddress );
  2         4  
12              
13             our $VERSION = '0.001'; # VERSION;
14              
15             declare EmailAddress,
16             as Str,
17             where { Email::Valid->address( -address => $_ ) },
18             inline_as {
19             my ($constraint, $varname) = @_;
20             return sprintf(
21             '%s and Email::Valid->address( -address => %s )',
22             $constraint->parent->inline_check($varname),
23             $varname,
24             );
25             };
26              
27             1;
28              
29             __END__