line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::POP3::XOAuth2; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
699
|
use 5.008001; |
|
1
|
|
|
|
|
3
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
18
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
62
|
|
8
|
1
|
|
|
1
|
|
566
|
use Net::POP3; |
|
1
|
|
|
|
|
95662
|
|
|
1
|
|
|
|
|
66
|
|
9
|
1
|
|
|
1
|
|
527
|
use MIME::Base64; |
|
1
|
|
|
|
|
696
|
|
|
1
|
|
|
|
|
232
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.0.1'; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
0
|
|
|
*Net::POP3::_AUTH = sub { shift->command('AUTH', $_[0])->response() == Net::POP3::CMD_OK }; |
14
|
|
|
|
|
|
|
*Net::POP3::xoauth2 = sub { |
15
|
0
|
0
|
0
|
0
|
|
|
@_ >= 1 && @_ <= 3 or croak 'usage: $pop3->xoauth2( USER, TOKEN )'; |
16
|
0
|
|
|
|
|
|
my ($me, $user, $token) = @_; |
17
|
0
|
|
|
|
|
|
my $xoauth2_token = encode_base64("user=$user\001auth=Bearer $token\001\001"); |
18
|
0
|
|
|
|
|
|
$xoauth2_token =~ s/[\r\n]//g; |
19
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
|
|
|
return unless ($me->_AUTH("XOAUTH2 $xoauth2_token")); |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
$me->_get_mailbox_count(); |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
1; |
26
|
|
|
|
|
|
|
__END__ |