line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
728
|
use 5.010; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
32
|
|
2
|
1
|
|
|
1
|
|
3
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
3
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
18
|
|
4
|
1
|
|
|
1
|
|
2
|
use utf8; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
4
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
198
|
use JE (); |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package JSON::T::JE; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
11
|
|
|
|
|
|
|
our $VERSION = '0.104'; |
12
|
|
|
|
|
|
|
our @ISA = qw( JSON::T ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub init |
15
|
|
|
|
|
|
|
{ |
16
|
|
|
|
|
|
|
my $self = shift; |
17
|
|
|
|
|
|
|
my (@args) = @_; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $JS = $self->{engine} = JE::->new; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
$JS->new_function("return_to_perl", sub { |
22
|
|
|
|
|
|
|
$self->_accept_return_value(@_); |
23
|
|
|
|
|
|
|
}); |
24
|
|
|
|
|
|
|
$JS->new_function("print_to_perl", sub { |
25
|
|
|
|
|
|
|
print @_; |
26
|
|
|
|
|
|
|
}); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$self->SUPER::init(@args); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub engine_eval |
32
|
|
|
|
|
|
|
{ |
33
|
|
|
|
|
|
|
my $self = shift; |
34
|
|
|
|
|
|
|
my ($code) = @_; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return $self->{engine}->eval($code); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub parameters |
40
|
|
|
|
|
|
|
{ |
41
|
|
|
|
|
|
|
my $self = shift; |
42
|
|
|
|
|
|
|
my (%args) = @_; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
for my $k (sort keys %args) |
45
|
|
|
|
|
|
|
{ |
46
|
|
|
|
|
|
|
my $v = $args{$k}; |
47
|
|
|
|
|
|
|
$v = $v->[1] if ref $v eq 'ARRAY'; |
48
|
|
|
|
|
|
|
$self->engine_eval("var $k;"); |
49
|
|
|
|
|
|
|
$self->engine_eval($k)->set(JE::Object::String::->new($self->{'engine'}, $v)); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |