line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
252
|
|
2
|
|
|
|
|
|
|
package Mail::Audit::MimeEntity; |
3
|
|
|
|
|
|
|
{ |
4
|
|
|
|
|
|
|
$Mail::Audit::MimeEntity::VERSION = '2.228'; |
5
|
|
|
|
|
|
|
} |
6
|
|
|
|
|
|
|
# ABSTRACT: a Mail::Internet-based Mail::Audit object |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
7
|
use File::Path; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
91
|
|
9
|
1
|
|
|
1
|
|
591
|
use Mail::Audit::Util::Tempdir; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
25
|
|
10
|
1
|
|
|
1
|
|
1166
|
use MIME::Parser; |
|
1
|
|
|
|
|
121880
|
|
|
1
|
|
|
|
|
42
|
|
11
|
1
|
|
|
1
|
|
13
|
use MIME::Entity; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
12
|
1
|
|
|
1
|
|
7
|
use Mail::Audit::MailInternet; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
13
|
1
|
|
|
1
|
|
6
|
use parent qw(Mail::Audit MIME::Entity); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $parser; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my @to_rmdir; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _autotype_new { |
20
|
1
|
|
|
1
|
|
2
|
my $class = shift; |
21
|
1
|
|
|
|
|
3
|
my $mailinternet = shift; |
22
|
1
|
|
|
|
|
4
|
my $options = shift; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
5
|
$parser = MIME::Parser->new(); |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
164
|
$parser->ignore_errors(1); |
27
|
|
|
|
|
|
|
|
28
|
1
|
|
|
|
|
6
|
my $dir; |
29
|
1
|
50
|
|
|
|
5
|
if ($options->{output_to_core}) { |
30
|
0
|
|
|
|
|
0
|
$parser->output_to_core($options->{output_to_core}); |
31
|
|
|
|
|
|
|
} else { |
32
|
1
|
|
|
|
|
9
|
$dir = Mail::Audit::Util::Tempdir->new; |
33
|
1
|
|
|
|
|
9
|
$mailinternet->_log(3, "created temporary directory " . $dir->name); |
34
|
1
|
|
|
|
|
9
|
$parser->output_under($dir->name); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
# MIME::Parser has options like extract_nested_messages which are set via |
38
|
|
|
|
|
|
|
# option-methods. |
39
|
|
|
|
|
|
|
# we'll hand them along here so that if you call Mail::Audit(mimeoptions => |
40
|
|
|
|
|
|
|
# { foo => 1 }) |
41
|
|
|
|
|
|
|
# the corresponding parser option is set, with $parser->foo(1). |
42
|
1
|
|
|
|
|
107
|
foreach my $option (keys %$options) { |
43
|
0
|
0
|
|
|
|
0
|
next if $option eq "output_to_core"; |
44
|
0
|
0
|
|
|
|
0
|
if ($parser->can($option)) { $parser->$option($options->{$option}); } |
|
0
|
|
|
|
|
0
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
1
|
|
|
|
|
10
|
my $self = $parser->parse_data( |
48
|
1
|
|
|
|
|
2
|
[ @{ $mailinternet->head->header }, "\n", @{ $mailinternet->body } ] |
|
1
|
|
|
|
|
28
|
|
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# I am so, so sorry that this sort of thing is needed. |
52
|
|
|
|
|
|
|
# -- rjbs, 2007-06-14 |
53
|
1
|
|
|
|
|
12216
|
$self->{_log} = $mailinternet->{_log}; |
54
|
|
|
|
|
|
|
|
55
|
1
|
50
|
|
|
|
6
|
unless ($options->{output_to_core}) { |
56
|
1
|
|
|
|
|
3
|
my $output_dir = $parser->filer->output_dir; |
57
|
1
|
|
|
|
|
15
|
$mailinternet->_log(3, "outputting under $output_dir"); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# Augh! These guts are so foul and convoluted. I feel like I might as well |
61
|
|
|
|
|
|
|
# be using guids. Whatever, this will solve the tempdir-lingers-too-long |
62
|
|
|
|
|
|
|
# problem. -- rjbs, 2006-10-31 |
63
|
1
|
|
|
|
|
3
|
$self->{'__Mail::Audit::MimeEntity/tempdir'} = $dir; |
64
|
1
|
|
|
|
|
5
|
bless($self, $class); |
65
|
1
|
|
|
|
|
5
|
return $self; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
0
|
|
0
|
0
|
1
|
0
|
sub parser { $parser ||= MIME::Parser->new(); } |
70
|
|
|
|
|
|
|
|
71
|
1
|
|
|
1
|
1
|
10
|
sub is_mime { 1; } |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
1; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
__END__ |