line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
83575
|
use strict; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
73
|
|
2
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
124
|
|
3
|
|
|
|
|
|
|
package MIME::Visitor; |
4
|
|
|
|
|
|
|
{ |
5
|
|
|
|
|
|
|
$MIME::Visitor::VERSION = '0.006'; |
6
|
|
|
|
|
|
|
} |
7
|
|
|
|
|
|
|
# ABSTRACT: walk through MIME parts and do stuff (like rewrite) |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
11
|
use Encode; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
197
|
|
10
|
2
|
|
|
2
|
|
1040
|
use MIME::BodyMunger; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
803
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub walk_parts { |
14
|
14
|
|
|
14
|
1
|
31
|
my ($self, $root, $code) = @_; |
15
|
|
|
|
|
|
|
|
16
|
14
|
|
|
|
|
28
|
$code->($root); |
17
|
14
|
|
|
|
|
1924
|
for my $part ($root->parts) { |
18
|
8
|
|
|
|
|
109
|
$self->walk_parts($part, $code); |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub walk_leaves { |
24
|
6
|
|
|
6
|
1
|
11
|
my ($self, $root, $code) = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$self->walk_parts( |
27
|
|
|
|
|
|
|
$root, |
28
|
|
|
|
|
|
|
sub { |
29
|
14
|
100
|
|
14
|
|
55
|
return if $_[0]->is_multipart; |
30
|
10
|
|
|
|
|
1757
|
$code->($_[0]); |
31
|
|
|
|
|
|
|
}, |
32
|
6
|
|
|
|
|
37
|
); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub walk_text_leaves { |
37
|
6
|
|
|
6
|
1
|
17
|
my ($self, $root, $code) = @_; |
38
|
|
|
|
|
|
|
$self->walk_leaves($root, sub { |
39
|
10
|
100
|
|
10
|
|
37
|
return unless $_[0]->effective_type =~ qr{\Atext/(?:html|plain)(?:$|;)}i; |
40
|
8
|
|
|
|
|
1293
|
$code->($_[0]); |
41
|
6
|
|
|
|
|
38
|
}); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub rewrite_parts { |
46
|
1
|
|
|
1
|
1
|
16466
|
my ($self, $root, $code) = @_; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$self->walk_text_leaves($root, sub { |
49
|
0
|
|
|
0
|
|
0
|
my ($part) = @_; |
50
|
0
|
|
|
|
|
0
|
MIME::BodyMunger->rewrite_content($part, $code); |
51
|
1
|
|
|
|
|
8
|
}); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub rewrite_all_lines { |
56
|
5
|
|
|
5
|
1
|
57467
|
my ($self, $root, $code) = @_; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
$self->walk_text_leaves($root, sub { |
59
|
8
|
|
|
8
|
|
14
|
my ($part) = @_; |
60
|
8
|
|
|
|
|
64
|
MIME::BodyMunger->rewrite_lines($part, $code); |
61
|
5
|
|
|
|
|
38
|
}); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |