line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Error::Pure::Output::JSON; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Pragmas. |
4
|
3
|
|
|
3
|
|
91200
|
use base qw(Exporter); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
364
|
|
5
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
64
|
|
6
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
93
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# Modules. |
9
|
3
|
|
|
3
|
|
3228
|
use JSON; |
|
3
|
|
|
|
|
80232
|
|
|
3
|
|
|
|
|
19
|
|
10
|
3
|
|
|
3
|
|
3701
|
use Readonly; |
|
3
|
|
|
|
|
11052
|
|
|
3
|
|
|
|
|
585
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Constants. |
13
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(err_json); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# Global variables. |
16
|
|
|
|
|
|
|
our $PRETTY = 0; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Version. |
19
|
|
|
|
|
|
|
our $VERSION = 0.10; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# JSON print of backtrace. |
22
|
|
|
|
|
|
|
sub err_json { |
23
|
2
|
|
|
2
|
1
|
800
|
my @errors = @_; |
24
|
2
|
|
|
|
|
2
|
my $ret_json; |
25
|
2
|
|
|
|
|
15
|
my $json = JSON->new; |
26
|
2
|
100
|
|
|
|
6
|
if ($PRETTY) { |
27
|
1
|
|
|
|
|
12
|
$ret_json = $json->pretty->encode(@errors); |
28
|
|
|
|
|
|
|
} else { |
29
|
1
|
|
|
|
|
17
|
$ret_json = $json->encode(@errors); |
30
|
|
|
|
|
|
|
} |
31
|
2
|
|
|
|
|
13
|
return $ret_json; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
__END__ |