| 1 | package Data::Validate::WithYAML::Plugin::EMail; | ||||||||||
| 2 | |||||||||||
| 3 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 4 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 4 | ▶ | use Regexp::Common qw[Email::Address]; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | # ABSTRACT: Plugin for Data::Validate::WithYAML to check email addresses | ||||||||||
| 10 | |||||||||||
| 11 | 4 | our $VERSION = '0.04'; | |||||||||
| 12 | |||||||||||
| 13 | 12 | ▶ | sub check { | ||||||||
|
Subroutine
check: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 14 | 12 | my ($class, $value) = @_; | |||||||||
| 15 | |||||||||||
| 16 | 12 | ▶ | croak "no value to check" unless defined $value; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 17 | |||||||||||
| 18 | 11 | my $return = 0; | |||||||||
| 19 | 11 | ▶ | if( $value =~ /($RE{Email}{Address})/ ){ | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 8 | $return = 1; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 11 | return $return; | |||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | |||||||||||
| 27 | 4 | 1; # End of Data::Validate::WithYAML::Plugin::EMail | |||||||||
| 28 | |||||||||||
| 29 | __END__ | ||||||||||