NAME

Data::Transpose::EmailValid - Perl extension to check if a mail is valid (with some autocorrection)

SYNOPSIS

use Data::Transpose::EmailValid;

my $email = Data::Transpose::EmailValid->new;

ok($email->is_valid("user@domain.tld"), "Mail is valid");

ok(!$email->is_valid("user_e;@domain.tld"), "Mail is not valid");

warn $email->reason; # output the reason of the failure

DESCRIPTION

This module check if the mail is valid, using the Email::Valid module. It also provides some additional methods.

AUTO CORRECTION

This validator corrects common mistakes automatically:

  • .ocm instead of .com as top level domain for aol.com, gmail.com, hotmail.com and yahoo.com, e.g. tp@gmail.ocm.

  • Double dots before top level domain, e.g. tp@linuxia..de.

Please suggest further auto correction examples to us.

METHODS

new

Constructor. It doesn't accept any arguments.

input

Accessor to the input email string.

output

Accessor to the output email string.

reset_all

Clear all the internal data

$obj->is_valid($emailstring);

Returns the email passed if valid, false underwise.

$obj->email

Returns the last checked email.

$obj->reason

Returns the reason of the failure of the last check, false if it was successful.

$obj->suggestion

This module implements some basic autocorrection. Calling ->suggestion after a successfull test, will return the suggested value if the input was different from the output, false otherwise.

AUTHOR

Uwe Voelker <uwe@uwevoelker.de>

LICENSE AND COPYRIGHT

Copyright 2012-2016 Uwe Voelker <uwe@uwevoelker.de>.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.