| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::Gnats::Attachment; |
|
2
|
40
|
|
|
40
|
|
207
|
use utf8; |
|
|
40
|
|
|
|
|
78
|
|
|
|
40
|
|
|
|
|
222
|
|
|
3
|
40
|
|
|
40
|
|
1098
|
use strictures; |
|
|
40
|
|
|
|
|
76
|
|
|
|
40
|
|
|
|
|
220
|
|
|
4
|
40
|
|
|
40
|
|
8142
|
use 5.10.00; |
|
|
40
|
|
|
|
|
172
|
|
|
5
|
40
|
|
|
40
|
|
219
|
use MIME::Base64; |
|
|
40
|
|
|
|
|
86
|
|
|
|
40
|
|
|
|
|
2673
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
BEGIN { |
|
8
|
40
|
|
|
40
|
|
947
|
$Net::Gnats::Attachment::VERSION = '0.22'; |
|
9
|
|
|
|
|
|
|
} |
|
10
|
40
|
|
|
40
|
|
207
|
use vars qw($VERSION); |
|
|
40
|
|
|
|
|
109
|
|
|
|
40
|
|
|
|
|
11622
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub new { |
|
13
|
3
|
|
|
3
|
0
|
9
|
my ($class, %options) = @_; |
|
14
|
3
|
|
|
|
|
6
|
my $self = bless \%options, $class; |
|
15
|
3
|
|
|
|
|
10
|
return $self; |
|
16
|
|
|
|
|
|
|
} |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
0
|
0
|
|
sub encode { |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub decode { |
|
23
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Split the envelope from the body. |
|
26
|
0
|
|
|
|
|
|
my ($envelope, $body) = split(/\n\n/, $self->{payload}, 2); |
|
27
|
0
|
0
|
0
|
|
|
|
return undef unless ($envelope && $body); |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
my $ex_envelope = qr{\sContent-Type:\s(.*)\n |
|
30
|
|
|
|
|
|
|
\sContent-Transfer-Encoding:\s(.*)\n |
|
31
|
|
|
|
|
|
|
\sContent-Disposition:\s(.*)\n}x; |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
($self->{content_type}, |
|
34
|
|
|
|
|
|
|
$self->{content_transfer_encoding}, |
|
35
|
0
|
|
|
|
|
|
$self->{content_disposition}) = $envelope =~ $ex_envelope; |
|
36
|
|
|
|
|
|
|
|
|
37
|
0
|
0
|
|
|
|
|
if ( $self->{content_transfer_encoding} eq 'base64') { |
|
38
|
0
|
|
|
|
|
|
$self->{data} = decode_base64($body); |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
else { |
|
41
|
0
|
|
|
|
|
|
$self->{data} = $body; |
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
return 1; |
|
45
|
|
|
|
|
|
|
} |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |