line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mail::Lite::Processor::SplitMsg; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
87
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
60
|
|
5
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
11
|
use Mail::Lite::Constants; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
178
|
|
7
|
2
|
|
|
2
|
|
12
|
use Smart::Comments -ENV; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
24
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
1174
|
use Clone qw/clone/; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
844
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub process { |
12
|
28
|
|
|
28
|
0
|
65
|
my $args_ref = shift; |
13
|
|
|
|
|
|
|
|
14
|
28
|
|
|
|
|
130
|
my $processor_args = $args_ref->{processor}; |
15
|
|
|
|
|
|
|
|
16
|
28
|
50
|
|
|
|
107
|
if ( not exists $processor_args->{separator} ) { |
17
|
0
|
|
|
|
|
0
|
die "not found separator for split"; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
28
|
|
|
|
|
64
|
my $message = $args_ref->{input}; |
21
|
|
|
|
|
|
|
|
22
|
28
|
50
|
|
|
|
46
|
if ( not eval { $message->can('body') } ) { |
|
28
|
|
|
|
|
193
|
|
23
|
0
|
|
|
|
|
0
|
die "first param for split MUST be an message"; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
28
|
|
|
|
|
103
|
my $message_body = $message->body; |
27
|
28
|
|
|
|
|
76
|
my ( $begin_with, $end_with ) = ('', ''); |
28
|
|
|
|
|
|
|
|
29
|
28
|
50
|
|
|
|
98
|
if ( my $begin = $processor_args->{begin} ) { |
30
|
28
|
|
|
|
|
808
|
$message_body =~ s/(.*?$begin)//s; |
31
|
28
|
|
50
|
|
|
177
|
$begin_with = $1 || ''; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
28
|
50
|
|
|
|
233
|
if ( my $end = $processor_args->{end} ) { |
35
|
28
|
|
|
|
|
576
|
$message_body =~ s/($end.*)//s; |
36
|
28
|
|
50
|
|
|
123
|
$end_with = $1 || ''; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
28
|
|
|
|
|
45
|
my @new_messages; |
40
|
|
|
|
|
|
|
|
41
|
28
|
|
|
|
|
60
|
my $separator = $processor_args->{separator}; |
42
|
28
|
|
|
|
|
344
|
foreach my $message_body_part (split /$separator/, $message_body) { |
43
|
190
|
|
|
|
|
13268
|
my $new_message = clone( $message ); |
44
|
|
|
|
|
|
|
|
45
|
190
|
50
|
|
|
|
838
|
if ( $args_ref->{emulate} ) { |
46
|
0
|
|
|
|
|
0
|
$new_message->{body} = |
47
|
|
|
|
|
|
|
join q{}, $begin_with, $message_body_part, $end_with; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
else { |
50
|
190
|
|
|
|
|
458
|
$new_message->{body} = $message_body_part; |
51
|
|
|
|
|
|
|
} |
52
|
190
|
|
|
|
|
419
|
push @new_messages, $new_message; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
28
|
|
|
|
|
90
|
${ $args_ref->{ output } } = \@new_messages; |
|
28
|
|
|
|
|
97
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
## $params |
58
|
|
|
|
|
|
|
|
59
|
28
|
|
|
|
|
115
|
return OK; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1; |