Widget/Constraint/Email.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 26 CC 3 SCAR 18.4
CC
3
Cov
0%
validate
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 6.3
1 package HTML::Widget::Constraint::Email;
2  
3 use warnings;
4 use strict;
5 use base 'HTML::Widget::Constraint';
6 use Email::Valid;
7  
8 =head1 NAME
9  
10 HTML::Widget::Constraint::Email - Email Constraint
11  
12 =head1 SYNOPSIS
13  
14 my $c = $widget->constraint( 'Email', 'foo' );
15  
16 =head1 DESCRIPTION
17  
18 Email Constraint.
19  
20 =head1 METHODS
21  
22 =head2 validate
23  
24 =cut
25  
26 sub validate {
27 my ( $self, $value ) = @_;
28 return 1 unless $value;
29 return 0 unless Email::Valid->address( -address => $value );
30 return 1;
31 }
32  
33 =head1 AUTHOR
34  
35 Sebastian Riedel, C<sri@oook.de>
36  
37 =head1 LICENSE
38  
39 This library is free software, you can redistribute it and/or modify it under
40 the same terms as Perl itself.
41  
42 =cut
43  
44 1;