blib/lib/Dallycot/AST/PropWalk.pm

filter: Statementstmt 87.8% 36 / 41 Branchbran 50.0% 6 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 81.8% 9 / 11 Podpod 0.0% 0 / 3 totaltotal 76.1% 51 / 67 CC 7 SCAR 9.2
CC
7
Cov
79%
__ANON__
4.5
__ANON__
3.8
process_loop
2.1
CRAP 2.5
« blib/lib/Dallycot/Value/URI.pm ↑ Summary blib/lib/Dallycot/AST/Modulus.pm »
1 package Dallycot::AST::PropWalk;
2 29 our $AUTHORITY = 'cpan:JSMITH';
3  
4 # ABSTRACT: Manages traversal of a graph
5  
6 29 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 29 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 29 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 29 ▶use parent 'Dallycot::AST::LoopBase';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 29 ▶use Promises qw(collect deferred);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 ▶sub to_string {
Subroutine to_string: not called CC=1 SCAR=0.0
Pod undocumented
15  
16 }
17  
18 sub execute {
19 3 ▶ my ( $self, $engine ) = @_;
Subroutine execute: called CC=1 SCAR=0.4
Pod undocumented
20  
21 3 my ( $root_expr, @steps ) = @$self;
22  
23 return $engine->execute($root_expr)->then(
24 sub {
25 3 ▶ my ($root) = [@_];
Subroutine __ANON__: called CC=3 SCAR=13.5
26  
27 3 ▶ if (@steps) {
Branch: 2 branches
BranchTrueFalseTotal
if (@steps) { } 3 0 3
elsif (@$root > 1) { } 0 0 0
28 3 my $d = deferred;
29 3 $self->process_loop( $engine, $d, root => $root, steps => \@steps );
30 3 return $d;
31 }
32 elsif ( @$root > 1 ) {
33 0 return bless $root => "Dallycot::Value::Set";
34 }
35 else {
36 0 return @$root;
37 }
38 }
39 3 );
40 }
41  
42 sub process_loop {
43 4 ▶ my ( $self, $engine, $d, %state ) = @_;
Subroutine process_loop: called CC=2 SCAR=7.3
Pod undocumented
44  
45 4 ▶ my ( $root, $step, @steps ) = ( $state{root}, @{ $state{steps} || [] } );
Branch: 1 branch
BranchTrueFalseTotal
$state{"steps"} or [] 0 4 4
46  
47 4 collect( map { $step->step( $engine, $_ ) } @$root )->done(
48 sub {
49 4 ▶ my (@results) = map {@$_} @_;
Subroutine __ANON__: called CC=4 SCAR=15.0
50 4 ▶ if (@steps) {
Branch: 3 branches
BranchTrueFalseTotal
if (@steps) { } 1 3 4
elsif (@results > 1) { } 0 3 3
elsif (@results == 1) { } 3 0 3
51 1 $self->process_loop( $engine, $d, root => \@results, steps => \@steps );
52 }
53 elsif ( @results > 1 ) {
54 0 $d->resolve( bless \@results => "Dallycot::Value::Set" );
55 }
56 elsif ( @results == 1 ) {
57 3 $d->resolve(@results);
58 }
59 else {
60 0 $d->resolve( $engine->UNDEFINED );
61 }
62 },
63 sub {
64 0 ▶ $d->reject(@_);
Subroutine __ANON__: not called CC=1 SCAR=6.9
65 }
66 4 );
67  
68 4 return;
69 }
70  
71 29 1;
« blib/lib/Dallycot/Value/URI.pm ↑ Summary blib/lib/Dallycot/AST/Modulus.pm »