line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
12977
|
use strict; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
44
|
|
2
|
2
|
|
|
2
|
|
5
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
72
|
|
3
|
|
|
|
|
|
|
package Exception::Reporter::Dumper::YAML; |
4
|
|
|
|
|
|
|
# ABSTRACT: a dumper to turn any scalar value into a plaintext YAML record |
5
|
|
|
|
|
|
|
$Exception::Reporter::Dumper::YAML::VERSION = '0.014'; |
6
|
2
|
|
|
2
|
|
680
|
use parent 'Exception::Reporter::Dumper'; |
|
2
|
|
|
|
|
392
|
|
|
2
|
|
|
|
|
9
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
812
|
use Try::Tiny; |
|
2
|
|
|
|
|
2948
|
|
|
2
|
|
|
|
|
82
|
|
9
|
2
|
|
|
2
|
|
662
|
use YAML::XS (); |
|
2
|
|
|
|
|
3589
|
|
|
2
|
|
|
|
|
580
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _ident_from { |
12
|
8
|
|
|
8
|
|
19
|
my ($self, $str, $x) = @_; |
13
|
|
|
|
|
|
|
|
14
|
8
|
|
|
|
|
14
|
$str =~ s/\A\n+//; |
15
|
8
|
|
|
|
|
17
|
($str) = split /\n/, $str; |
16
|
|
|
|
|
|
|
|
17
|
8
|
50
|
33
|
|
|
69
|
unless (defined $str and length $str and $str =~ /\S/) { |
|
|
|
33
|
|
|
|
|
18
|
0
|
0
|
|
|
|
0
|
$str = sprintf "<>", $x ? ' ($x)' : ''; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
8
|
|
|
|
|
16
|
return $str; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub dump { |
25
|
6
|
|
|
6
|
0
|
4
|
my ($self, $value, $arg) = @_; |
26
|
6
|
|
50
|
|
|
11
|
my $basename = $arg->{basename} || 'dump'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my ($dump, $error) = try { |
29
|
6
|
|
|
6
|
|
511
|
(YAML::XS::Dump($value), undef); |
30
|
|
|
|
|
|
|
} catch { |
31
|
0
|
|
|
0
|
|
0
|
(undef, $_); |
32
|
6
|
|
|
|
|
23
|
}; |
33
|
|
|
|
|
|
|
|
34
|
6
|
50
|
|
|
|
71
|
if (defined $dump) { |
35
|
5
|
|
|
5
|
|
106
|
my $ident = ref $value ? (try { "$value" } catch { "" }) |
|
0
|
|
|
|
|
0
|
|
36
|
6
|
50
|
|
|
|
28
|
: defined $value ? "$value" # quotes in case of glob, vstr, etc. |
|
|
100
|
|
|
|
|
|
37
|
|
|
|
|
|
|
: "(undef)"; |
38
|
|
|
|
|
|
|
|
39
|
6
|
|
|
|
|
39
|
$ident = $self->_ident_from($ident); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return { |
42
|
6
|
|
|
|
|
27
|
filename => "$basename.yaml", |
43
|
|
|
|
|
|
|
mimetype => 'text/plain', |
44
|
|
|
|
|
|
|
body => $dump, |
45
|
|
|
|
|
|
|
ident => $ident, |
46
|
|
|
|
|
|
|
}; |
47
|
|
|
|
|
|
|
} else { |
48
|
0
|
|
|
0
|
|
|
my $string = try { "$value" } catch { "value could not stringify: $_" }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
49
|
0
|
|
|
|
|
|
my $ident = $self->_ident_from($string); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
return { |
52
|
0
|
|
|
|
|
|
filename => "$basename.txt", |
53
|
|
|
|
|
|
|
mimetype => 'text/plain', |
54
|
|
|
|
|
|
|
body => <
|
55
|
|
|
|
|
|
|
__DATA__ |