line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Gmail::Mailbox::Validate; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
64952
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
22
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
6
|
1
|
|
|
1
|
|
621
|
use Net::SMTP; |
|
1
|
|
|
|
|
97558
|
|
|
1
|
|
|
|
|
194
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Gmail::Mailbox::Validate - Find out if the username has a valid gmail mailbox |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Version 0.01 |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 SYNOPSIS |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
It's quite simple to use: |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use Gmail::Mailbox::Validate; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
my $v = Gmail::Mailbox::Validate->new(); |
28
|
|
|
|
|
|
|
print "mailbox exists" if $v->validate($username); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Or run via command line: |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
$ perl -MGmail::Mailbox::Validate -le 'print "mailbox exists" if Gmail::Mailbox::Validate->new()->validate("mytest")' |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 new |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
Initialize the object. |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=cut |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub new { |
44
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
45
|
0
|
|
|
|
|
|
bless {},$class; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head2 validate |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
Validate the mailbox for username provided. |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub validate { |
55
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
56
|
0
|
|
|
|
|
|
my $username = shift; |
57
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
|
my $smtp = Net::SMTP->new('gmail-smtp-in.l.google.com') or die $@; |
59
|
0
|
0
|
|
|
|
|
$smtp->mail('foo@bar.net') or die $@; |
60
|
|
|
|
|
|
|
|
61
|
0
|
0
|
|
|
|
|
my $status = $smtp->to($username . '@gmail.com') ? 1 : 0; |
62
|
0
|
|
|
|
|
|
$smtp->quit; |
63
|
|
|
|
|
|
|
|
64
|
0
|
|
|
|
|
|
return $status; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 AUTHOR |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Yonghua Peng, C<< >> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 BUGS |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, or through |
74
|
|
|
|
|
|
|
the web interface at L. I will be notified, and then you'll |
75
|
|
|
|
|
|
|
automatically be notified of progress on your bug as I make changes. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SUPPORT |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
perldoc Gmail::Mailbox::Validate |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
You can also look for information at: |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=over 4 |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
L |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
L |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item * CPAN Ratings |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item * Search CPAN |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
L |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=back |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This software is Copyright (c) 2019 by Yonghua Peng. |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
This is free software, licensed under: |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=cut |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
1; # End of Gmail::Mailbox::Validate |