line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package RapidApp::JSON::RawJavascript; |
2
|
|
|
|
|
|
|
|
3
|
6
|
|
|
6
|
|
46
|
use strict; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
192
|
|
4
|
6
|
|
|
6
|
|
33
|
use warnings; |
|
6
|
|
|
|
|
14
|
|
|
6
|
|
|
|
|
178
|
|
5
|
6
|
|
|
6
|
|
31
|
use Moose; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
39
|
|
6
|
|
|
|
|
|
|
|
7
|
6
|
|
|
6
|
|
40570
|
use overload '""' => sub { (shift)->stringify(@_) }; |
|
6
|
|
|
1097
|
|
17
|
|
|
6
|
|
|
|
|
69
|
|
|
1097
|
|
|
|
|
3148
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub stringify { |
10
|
1097
|
|
|
1097
|
0
|
1765
|
my $self = shift; |
11
|
1097
|
|
|
|
|
2493
|
return $self->TO_JSON_RAW; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has 'js' => ( is => 'rw', isa => 'Str' ); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# compat with RapidApp::JSONFunc API: |
17
|
0
|
|
|
0
|
0
|
0
|
sub func { (shift)->js } |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
around BUILDARGS => sub { |
20
|
|
|
|
|
|
|
my $orig= shift; |
21
|
|
|
|
|
|
|
my $class= shift; |
22
|
|
|
|
|
|
|
if (scalar(@_) == 1 && !ref $_[0]) { |
23
|
|
|
|
|
|
|
return $class->$orig( js => $_[0] ); # interpret single-param as a javascript fragment |
24
|
|
|
|
|
|
|
} else { |
25
|
|
|
|
|
|
|
return $class->$orig(@_); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub TO_JSON_RAW { |
30
|
1128
|
|
|
1128
|
0
|
30990
|
return (shift)->js; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
6
|
|
|
6
|
|
1565
|
no Moose; |
|
6
|
|
|
|
|
16
|
|
|
6
|
|
|
|
|
38
|
|
34
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
35
|
|
|
|
|
|
|
1; |