| 1 | package JQ::Lite::Runtime; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 182 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 182 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 182 | ▶ | use JQ::Lite::Error (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 182 | ▶ | use JQ::Lite::Filters (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 182 | ▶ | use JQ::Lite::Util (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 6053 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 11 | 6053 | my ($class, %opts) = @_; | |||||||||||||||||||||||||||
| 12 | 6053 | ▶ | die 'runtime owner is required' unless $opts{owner}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 13 | 6053 | return bless { owner => $opts{owner} }, $class; | |||||||||||||||||||||||||||
| 14 | } | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 6053 | ▶ | sub decode_input { | ||||||||||||||||||||||||||
|
Subroutine
decode_input: called CC=4 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||||||||||
| 17 | 6053 | my ($self, $json_text) = @_; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 6053 | my ($value, $ok, $error); | |||||||||||||||||||||||||||
| 20 | { | ||||||||||||||||||||||||||||
| 21 | 6053 | local $@; | |||||||||||||||||||||||||||
| 22 | 6053 | $ok = eval { | |||||||||||||||||||||||||||
| 23 | 6053 | $value = JQ::Lite::Util::_decode_json($json_text); | |||||||||||||||||||||||||||
| 24 | 6052 | 1; | |||||||||||||||||||||||||||
| 25 | }; | ||||||||||||||||||||||||||||
| 26 | 6053 | $error = $@; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 6053 | ▶ | return $value if $ok; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | die $error if ref($error) && eval { $error->isa('JQ::Lite::Error') }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $error and eval {
do {
$error->isa("JQ::Lite::Error")
}
}
MC/DC0%0/2
ref $error and eval {
do {
$error->isa("JQ::Lite::Error")
}
}
ref $error
eval {
do {
$error->isa("JQ::Lite::Error")
}
}
Truth table33%1/3
A and B
A= ref $errorB= eval {
do {
$error->isa("JQ::Lite::Error")
}
}
| |||||||||||||||||||||||||||||
| 31 | 1 | die JQ::Lite::Error::Input->new(message => $error); | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 1528 | ▶ | sub evaluate_filter { | ||||||||||||||||||||||||||
|
Subroutine
evaluate_filter: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 35 | 1528 | my ($self, $filter, $inputs) = @_; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 1528 | my @outputs; | |||||||||||||||||||||||||||
| 38 | 1528 | ▶ | if (JQ::Lite::Filters::apply( | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 39 | $self->{owner}, $filter->source, $inputs, \@outputs | ||||||||||||||||||||||||||||
| 40 | )) | ||||||||||||||||||||||||||||
| 41 | { | ||||||||||||||||||||||||||||
| 42 | 957 | return @outputs; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 508 | for my $input (@{$inputs}) { | |||||||||||||||||||||||||||
| 46 | 527 | push @outputs, JQ::Lite::Util::_traverse($input, $filter->source); | |||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | 505 | return @outputs; | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 182 | 1; | |||||||||||||||||||||||||||