/usr/share/perl5/CGI/Untaint/email.pm is in libcgi-untaint-email-perl 0.03-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | package CGI::Untaint::email;
use strict;
use vars qw($VERSION);
$VERSION = '0.03';
use base qw(CGI::Untaint::printable);
use Email::Valid;
use Mail::Address;
my $validator = Email::Valid->new(
-fudge => 0,
-fqdn => 1,
-local_rules => 0,
-mxcheck => 0,
);
sub is_valid {
my $self = shift;
if ($validator->address($self->value)) {
my @address = Mail::Address::overload->parse($self->value);
return $self->value($address[0]);
}
return;
}
package Mail::Address::overload;
use base qw(Mail::Address);
use overload
'""' => sub { $_[0]->format },
fallback => 1;
1;
__END__
=head1 NAME
CGI::Untaint::email - validate an email address
=head1 SYNOPSIS
use CGI::Untaint;
my $handler = CGI::Untaint->new($q->Vars);
my $email = $handler->extract(-as_email => 'emailaddress');
=head1 DESCRIPTION
CGI::Untaint::email input handler verifies that it is a valid RFC2822
mailbox format.
The resulting value will be a Mail::Address instance.
=head1 AUTHOR
Tatsuhiko Miyagawa E<lt>miyagawa@bulknews.netE<gt>
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 SEE ALSO
L<CGI::Untaint>, L<Email::Valid>
=cut
|