| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mail::Colander::Server::Util; |
|
2
|
1
|
|
|
1
|
|
11
|
use v5.24; |
|
|
1
|
|
|
|
|
3
|
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
63
|
|
|
4
|
1
|
|
|
1
|
|
25
|
use experimental qw< signatures >; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
|
|
{ our $VERSION = '0.004' } |
|
6
|
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
620
|
use Data::HexDump::XXD qw< xxd >; |
|
|
1
|
|
|
|
|
909
|
|
|
|
1
|
|
|
|
|
65
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use Exporter qw< import >; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
396
|
|
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw< xxd_message >; |
|
11
|
|
|
|
|
|
|
|
|
12
|
0
|
|
|
0
|
1
|
|
sub xxd_message ($data, %opts) { |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
|
my @lines = xxd($data); |
|
14
|
|
|
|
|
|
|
|
|
15
|
0
|
|
0
|
|
|
|
my $n_max_lines = $opts{max_lines} // 3; |
|
16
|
0
|
0
|
0
|
|
|
|
if ($n_max_lines > 0 && @lines > $n_max_lines) { |
|
17
|
0
|
0
|
|
|
|
|
if ($n_max_lines == 1) { |
|
|
|
0
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
splice(@lines, 1); |
|
19
|
|
|
|
|
|
|
} |
|
20
|
|
|
|
|
|
|
elsif ($n_max_lines == 2) { |
|
21
|
0
|
|
|
|
|
|
splice(@lines, 1); |
|
22
|
0
|
|
|
|
|
|
push(@lines, '...'); |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
else { |
|
25
|
0
|
|
|
|
|
|
my $last_line = pop(@lines); |
|
26
|
0
|
|
|
|
|
|
splice(@lines, $n_max_lines - 2); |
|
27
|
0
|
|
|
|
|
|
push(@lines, '...', $last_line); |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
|
0
|
|
|
|
my $prefix = $opts{prefix} // ' '; |
|
32
|
0
|
|
|
|
|
|
@lines = map { $prefix . $_ } @lines; |
|
|
0
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
0
|
|
|
|
|
if (defined(my $pre = $opts{preamble})) { |
|
35
|
0
|
0
|
|
|
|
|
unshift(@lines, ref($pre) eq 'ARRAY' ? $pre->@* : $pre); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
0
|
0
|
|
|
|
|
return @lines if wantarray; |
|
39
|
0
|
|
|
|
|
|
return join("\n", @lines); |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |