line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
2
|
|
|
|
|
|
|
package DBIx::DataModel::Schema::ResultAs::Json; |
3
|
|
|
|
|
|
|
#---------------------------------------------------------------------- |
4
|
1
|
|
|
1
|
|
767
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
44
|
|
5
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
6
|
1
|
|
|
1
|
|
5
|
use Carp::Clan qw[^(DBIx::DataModel::|SQL::Abstract)]; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
7
|
1
|
|
|
1
|
|
112
|
use JSON::MaybeXS (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use parent 'DBIx::DataModel::Schema::ResultAs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
88
|
use namespace::clean; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
1
|
|
|
1
|
0
|
3
|
my ($class, %json_options) = @_; |
15
|
1
|
50
|
|
|
|
7
|
keys %json_options |
16
|
|
|
|
|
|
|
or %json_options = ( pretty => 1, |
17
|
|
|
|
|
|
|
allow_blessed => 1, |
18
|
|
|
|
|
|
|
convert_blessed => 1 ); |
19
|
1
|
|
|
|
|
4
|
return bless \%json_options, $class; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub get_result { |
24
|
1
|
|
|
1
|
1
|
2
|
my ($self, $statement) = @_; |
25
|
|
|
|
|
|
|
|
26
|
1
|
|
|
|
|
15
|
my $json_maker = JSON::MaybeXS->new(%$self); |
27
|
1
|
|
|
|
|
36
|
my $json = $json_maker->encode($statement->all); |
28
|
1
|
|
|
|
|
21
|
return $json; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |