Subject: | MX checked before TLD |
If both -mxcheck and -tldcheck are specified in address(), the mx check
occurs before tld check. If the tld is invalid, mxcheck will always
fail. Doing the tld check before the mx will prevent checking on known
bad tld's (cutting down on network load).
To reproduce -
#!/usr/bin/perl -w -T
use strict;
use Email::Valid;
my $bad = 'me@somedomain.none';
Email::Valid->tld($bad) or print "'tld' check failed\n";
Email::Valid->mx($bad) or print "'mx' check failed\n";
Email::Valid->address(
-address=>$bad,
-mxcheck=>1,
-tldcheck=>1
) or print "'address' check failed (".Email::Valid->details().")\n";
exit(0);
Subject: | Valid.pm.diff |
--- Valid.pm Thu Jan 10 13:37:48 2008
+++ Valid.fix.pm Thu Jan 10 13:26:40 2008
@@ -316,14 +316,14 @@
or return $self->details('fqdn');
}
+ if ($args{tldcheck}) {
+ $self->tld( $addr->host ) or return $self->details('tldcheck');
+ }
+
if ($args{mxcheck}) {
# I'm not sure this ->details call is needed, but I'll test for it later.
# The whole ->details thing is... weird. -- rjbs, 2006-06-08
$self->mx( $addr->host ) or return $self->details('mxcheck');
- }
-
- if ($args{tldcheck}) {
- $self->tld( $addr->host ) or return $self->details('tldcheck');
}
return (wantarray ? ($addr->address, $addr) : $addr->address);