line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MIME::Base64; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
6219
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
206
|
|
4
|
4
|
|
|
4
|
|
20
|
use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION); |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
1055
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
require Exporter; |
7
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
8
|
|
|
|
|
|
|
@EXPORT = qw(encode_base64 decode_base64); |
9
|
|
|
|
|
|
|
@EXPORT_OK = qw(encode_base64url decode_base64url encoded_base64_length decoded_base64_length); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
$VERSION = '3.15'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
require XSLoader; |
14
|
|
|
|
|
|
|
XSLoader::load('MIME::Base64', $VERSION); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
*encode = \&encode_base64; |
17
|
|
|
|
|
|
|
*decode = \&decode_base64; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub encode_base64url { |
20
|
0
|
|
|
0
|
1
|
|
my $e = encode_base64(shift, ""); |
21
|
0
|
|
|
|
|
|
$e =~ s/=+\z//; |
22
|
0
|
|
|
|
|
|
$e =~ tr[+/][-_]; |
23
|
0
|
|
|
|
|
|
return $e; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub decode_base64url { |
27
|
0
|
|
|
0
|
1
|
|
my $s = shift; |
28
|
0
|
|
|
|
|
|
$s =~ tr[-_][+/]; |
29
|
0
|
|
|
|
|
|
$s .= '=' while length($s) % 4; |
30
|
0
|
|
|
|
|
|
return decode_base64($s); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |