line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
420
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
28
|
|
2
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
42
|
|
3
|
|
|
|
|
|
|
package Exception::Reporter::Summarizer::File 0.015; |
4
|
|
|
|
|
|
|
# ABSTRACT: a summarizer for a File object |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
9
|
use parent 'Exception::Reporter::Summarizer'; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
4
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#pod =head1 OVERVIEW |
9
|
|
|
|
|
|
|
#pod |
10
|
|
|
|
|
|
|
#pod This summarizer expects L objects, and |
11
|
|
|
|
|
|
|
#pod summarizes them just as you might expect. |
12
|
|
|
|
|
|
|
#pod |
13
|
|
|
|
|
|
|
#pod =cut |
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
53
|
use File::Basename (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
14
|
|
16
|
1
|
|
|
1
|
|
4
|
use Try::Tiny; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
265
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub can_summarize { |
19
|
12
|
|
|
12
|
0
|
32
|
my ($self, $entry) = @_; |
20
|
12
|
|
|
12
|
|
44
|
return try { $entry->[1]->isa('Exception::Reporter::Dumpable::File') }; |
|
12
|
|
|
|
|
297
|
|
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub summarize { |
24
|
2
|
|
|
2
|
0
|
7
|
my ($self, $entry) = @_; |
25
|
2
|
|
|
|
|
7
|
my ($name, $value, $arg) = @$entry; |
26
|
|
|
|
|
|
|
|
27
|
2
|
|
|
|
|
11
|
my $fn_base = $self->sanitize_filename( |
28
|
|
|
|
|
|
|
File::Basename::basename($value->path) |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
return { |
32
|
|
|
|
|
|
|
filename => $fn_base, |
33
|
|
|
|
|
|
|
mimetype => $value->mimetype, |
34
|
|
|
|
|
|
|
ident => "file at $name", |
35
|
2
|
50
|
|
|
|
12
|
body => ${ $value->contents_ref }, |
|
2
|
|
|
|
|
15
|
|
36
|
|
|
|
|
|
|
body_is_bytes => 1, |
37
|
|
|
|
|
|
|
($value->charset ? (charset => $value->charset) : ()), |
38
|
|
|
|
|
|
|
}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |