line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use Kelp::Base 'Kelp::Module'; |
3
|
28
|
|
|
28
|
|
11892
|
|
|
28
|
|
|
|
|
54
|
|
|
28
|
|
|
|
|
151
|
|
4
|
|
|
|
|
|
|
use JSON::MaybeXS; |
5
|
28
|
|
|
28
|
|
1711
|
|
|
28
|
|
|
|
|
48
|
|
|
28
|
|
|
|
|
3644
|
|
6
|
|
|
|
|
|
|
my ( $self, %args ) = @_; |
7
|
|
|
|
|
|
|
my $json = JSON::MaybeXS->new( |
8
|
37
|
|
|
37
|
1
|
117
|
map { $_ => $args{$_} } keys %args |
9
|
|
|
|
|
|
|
); |
10
|
37
|
|
|
|
|
98
|
$self->register( json => $json ); |
|
112
|
|
|
|
|
309
|
|
11
|
|
|
|
|
|
|
} |
12
|
37
|
|
|
|
|
757
|
|
13
|
|
|
|
|
|
|
1; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Kelp::Module::JSON - Simple JSON module for a Kelp application |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
package MyApp; |
23
|
|
|
|
|
|
|
use Kelp::Base 'Kelp'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub some_route { |
26
|
|
|
|
|
|
|
my $self = shift; |
27
|
|
|
|
|
|
|
return $self->json->encode( { yes => 1 } ); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 REGISTERED METHODS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
This module registers only one method into the application: C<json>. |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
The module will try to use backends in this order: I<Cpanel::JSON::XS, JSON::XS, JSON::PP>. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |