line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
12751
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
42
|
|
2
|
2
|
|
|
2
|
|
6
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
74
|
|
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.013'; |
6
|
2
|
|
|
2
|
|
754
|
use parent 'Exception::Reporter::Dumper'; |
|
2
|
|
|
|
|
424
|
|
|
2
|
|
|
|
|
8
|
|
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
807
|
use Try::Tiny; |
|
2
|
|
|
|
|
1911
|
|
|
2
|
|
|
|
|
83
|
|
9
|
2
|
|
|
2
|
|
671
|
use YAML::XS (); |
|
2
|
|
|
|
|
3562
|
|
|
2
|
|
|
|
|
556
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _ident_from { |
12
|
8
|
|
|
8
|
|
18
|
my ($self, $str, $x) = @_; |
13
|
|
|
|
|
|
|
|
14
|
8
|
|
|
|
|
16
|
$str =~ s/\A\n+//; |
15
|
8
|
|
|
|
|
18
|
($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
|
|
|
|
|
15
|
return $str; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub dump { |
25
|
6
|
|
|
6
|
0
|
5
|
my ($self, $value, $arg) = @_; |
26
|
6
|
|
50
|
|
|
13
|
my $basename = $arg->{basename} || 'dump'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
my ($dump, $error) = try { |
29
|
6
|
|
|
6
|
|
559
|
(YAML::XS::Dump($value), undef); |
30
|
|
|
|
|
|
|
} catch { |
31
|
0
|
|
|
0
|
|
0
|
(undef, $_); |
32
|
6
|
|
|
|
|
24
|
}; |
33
|
|
|
|
|
|
|
|
34
|
6
|
50
|
|
|
|
77
|
if (defined $dump) { |
35
|
5
|
|
|
5
|
|
85
|
my $ident = ref $value ? (try { "$value" } catch { "" }) |
|
0
|
|
|
|
|
0
|
|
36
|
6
|
50
|
|
|
|
31
|
: defined $value ? "$value" # quotes in case of glob, vstr, etc. |
|
|
100
|
|
|
|
|
|
37
|
|
|
|
|
|
|
: "(undef)"; |
38
|
|
|
|
|
|
|
|
39
|
6
|
|
|
|
|
38
|
$ident = $self->_ident_from($ident); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
return { |
42
|
6
|
|
|
|
|
28
|
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__ |