| 1 | package Neo4j::Cypher::Abstract::Peeler; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 6 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use List::Util 1.33 qw(any); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use Scalar::Util qw(looks_like_number blessed); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # issues to solve: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # quoting | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # parens | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # param binding | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | # quoting logic: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | # if config:bind = true | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | # if anon_placeholder (like ?) is in config, then return literals without | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # quoting in array $obj->bind_values, and the placeholder in the statement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | # if anon_placeholder is undef, then return literals quoted directly in the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | # statement; return named parameters in $obj->parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | # if config:bind false | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | # leave tokens and identifiers as-is, no bind_values or parameters | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 6 | our $VERSION = '0.1001'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 6 | our $VERSION = '0.1001'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 6 | my $SQL_ABSTRACT = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | sub puke(@); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | sub belch(@); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 6 | my %config = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | bind => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | anon_placeholder => undef, # '?', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | hash_op => '-and', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | array_op => '-or', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | list_braces => '[]', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | ineq_op => '<>', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | implicit_eq_op => '=', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | quote_lit => "'", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | esc_quote_lit => "\\", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | parameter_sigil => qw/^([:$?])|({[^}]+}$)/, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | quote_fld => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | safe_identifier => qw/[a-zA-Z_.]+/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | # for each operator type (key in %type_table), there | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | # should be a handler with the same name | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 6 | my %type_table = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | infix_binary => [qw{ - / % =~ = <> < > <= >= | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | -contains -starts_with -ends_with}], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | infix_listarg => [qw{ -in } ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | infix_distributable => [qw{ + * -and -or }], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | prefix => [qw{ -not }], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | postfix => [qw{ -is_null -is_not_null }], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | function => [qw{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | -abs -ceil -floor -rand -round -sign -degrees | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | -e -exp -log -log10 -sqrt -acos -asin -atan -atan2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | -cos -cot -haversin -pi -radians -sin -tan | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | -exists -toInt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | -left -lower -ltrim -replace -reverse -right | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | -rtrim -split -substring -toString -trim -upper | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | -length -size -type -id -coalesce -head -last | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | -labels -nodes -relationships -keys -tail -range | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | -collect -count -max -min -percentileCont | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | -percentileDisc -stDev -stDevP -sum | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | -shortestPath -allShortestPaths | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | }], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | predicate => [qw{ -all -any -none -single -filter}], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | extract => [qw{ -extract }], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | reduce => [qw{ -reduce }], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | list => [qw( -list )], # returns args in list format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | bind => [qw( -bind )], # handles parameters and literal quoting | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | thing => [qw( -thing )], # the literal thing itself | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 6 | my %dispatch; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 6 | foreach my $type (keys %type_table) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 6 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 72 | my @ops = @{$type_table{$type}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 72 | @dispatch{@ops} = ( *${type}{CODE} ) x @ops; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 34 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=10 SCAR=28.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 34 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 34 | ▶ | if ($args{dispatch} and !(ref $args{dispatch} eq 'HASH')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args{"dispatch"} and not ref $args{"dispatch"} eq "HASH"
MC/DC0%0/2
$args{"dispatch"} and not ref $args{"dispatch"} eq "HASH"
$args{"dispatch"}
not ref $args{"dispatch"} eq "HASH"
Truth table33%1/3
A and not(B)
A= $args{"dispatch"}B= not ref $args{"dispatch"} eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | puke "dispatch must be hashref mapping operators to coderefs (or absent)" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 34 | ▶ | if ($args{config} and !(ref $args{config} eq 'HASH')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$args{"config"} and not ref $args{"config"} eq "HASH"
MC/DC0%0/2
$args{"config"} and not ref $args{"config"} eq "HASH"
$args{"config"}
not ref $args{"config"} eq "HASH"
Truth table33%1/3
A and not(B)
A= $args{"config"}B= not ref $args{"config"} eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | puke "config must be hashref defining peeler options" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | my $self = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | dispatch => $args{dispatch} || \%dispatch, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | 34 | ▶ | config => $args{config} || \%config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%2/4
$args{'dispatch'} || \%dispatch
$args{'config'} || \%config
MC/DC0%0/1
$args{'dispatch'} || \%dispatch
$args{'dispatch'}
MC/DC0%0/1
$args{'config'} || \%config
$args{'config'}
Truth table50%1/2
A
A= $args{'dispatch'}
Truth table50%1/2
A
A= $args{'config'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | # update config elts according to constructor args | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 34 | ▶ | if (length scalar keys %args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 34 | for (keys %config) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 408 | ▶ | defined $args{$_} and $self->{config}{$_} = $args{$_}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 34 | bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | sub belch (@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | my($func) = (caller(1))[3]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
belch: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | Carp::carp "[$func] Warning: ", @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | sub puke (@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | my($func) = (caller(1))[3]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
puke: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | Carp::croak "[$func] Fatal: ", @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 30 | ▶ | sub bind_values { $_[0]->{bind_values} ? @{$_[0]->{bind_values}} : return ; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bind_values: called CC=2 SCAR=6.9
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 30 | ▶ | sub parameters { $_[0]->{parameters} ? @{$_[0]->{parameters}} : return ; } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parameters: called CC=2 SCAR=9.2
Pod
documented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | sub _dispatch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 248 | ▶ | $_[0]->{dispatch}{$_[1]}->(@_); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_dispatch: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | sub _quote_lit { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 167 | ▶ | my $arg = "$_[1]"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_quote_lit: called CC=5 SCAR=16.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 167 | my $q = $_[0]->{config}{quote_lit}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | 167 | ▶ | if (looks_like_number $arg or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
&looks_like_number($arg) or $arg =~ /^\s*$q(.*)$q\s*$/ or $arg =~ /$_[0]{"config"}{"parameter_sigil"}/ or builtin::blessed($_[1])
&looks_like_number($arg) or $arg =~ /^\s*$q(.*)$q\s*$/ or $arg =~ /$_[0]{"config"}{"parameter_sigil"}/
&looks_like_number($arg) or $arg =~ /^\s*$q(.*)$q\s*$/
MC/DC50%2/4
&looks_like_number($arg) or $arg =~ /^\s*$q(.*)$q\s*$/ or $arg =~ /$_[0]{"config"}{"parameter_sigil"}/ or builtin::blessed($_[1])
&looks_like_number($arg)
$arg =~ /^\s*$q(.*)$q\s*$/
$arg =~ /$_[0]{"config"}{"parameter_sigil"}/
builtin::blessed($_[1])
Truth table60%3/5
A or B or C or D
A= &looks_like_number($arg)B= $arg =~ /^\s*$q(.*)$q\s*$/C= $arg =~ /$_[0]{"config"}{"parameter_sigil"}/D= builtin::blessed($_[1])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | $arg =~ /^\s*$q(.*)$q\s*$/ or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | $arg =~ $_[0]->{config}{parameter_sigil} or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | blessed($_[1]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | # numeric, already quoted, a parameter, or an object | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 70 | return "$arg"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 97 | my $e = $_[0]->{config}{esc_quote_lit}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 97 | $arg =~ s/$q/$e$q/g; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 97 | return "$q$arg$q"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | sub _quote_fld { # noop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | return $_[1]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_quote_fld: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | sub express { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 30 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
express: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 30 | my $x = $_[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 30 | ▶ | if ($SQL_ABSTRACT) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 30 | $x = $self->canonize($x); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | 30 | return $self->peel($x); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | sub config { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 1 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
config: called CC=3 SCAR=13.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 1 | my ($key, $val) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 1 | ▶ | if (!defined $key) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | return %{$self->{config}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | elsif (!defined $val) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | return $self->{config}{$key}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 1 | return $self->{config}{$key} = $val; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | # canonize - rewrite mixed hash/array expressions in canonical lispy | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | # array format - interpret like SQL::A | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | sub canonize { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 69 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
canonize: called CC=1 SCAR=0.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 69 | my ($expr) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 69 | my $ret = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 69 | my ($do,$is_op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | $is_op = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 544 | ▶ | if (!defined $_[0] || ref $_[0]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=8 SCAR=21.3
Branch: 1 branch
Condition66%2/3
not defined $_[0] or ref $_[0]
MC/DC50%1/2
not defined $_[0] or ref $_[0]
not defined $_[0]
ref $_[0]
Truth table66%2/3
not(A) or B
A= not defined $_[0]B= ref $_[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | 8 | return 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 536 | ▶ | if (!$_[1]) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 213 | ▶ | if (defined $self->{dispatch}{$_[0]}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 63 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | 150 | ▶ | puke "Unknown operator '$_[0]'" if ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
not $_[0] =~ /$self->{"config"}{"safe_identifier"}/ and $_[0] =~ /^-|[[:punct:]]/ and not &looks_like_number($_[0])
not $_[0] =~ /$self->{"config"}{"safe_identifier"}/ and $_[0] =~ /^-|[[:punct:]]/
MC/DC0%0/3
not $_[0] =~ /$self->{"config"}{"safe_identifier"}/ and $_[0] =~ /^-|[[:punct:]]/ and not &looks_like_number($_[0])
not $_[0] =~ /$self->{"config"}{"safe_identifier"}/
$_[0] =~ /^-|[[:punct:]]/
not &looks_like_number($_[0])
Truth table50%2/4
not(A) and B and not(C)
A= not $_[0] =~ /$self->{"config"}{"safe_identifier"}/B= $_[0] =~ /^-|[[:punct:]]/C= not &looks_like_number($_[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | $_[0] !~ /$$self{config}{safe_identifier}/ and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | $_[0]=~/^-|[[:punct:]]/ and !looks_like_number($_[0]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | 150 | 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 323 | grep /^\Q$_[0]\E$/, @{$type_table{$_[1]}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 69 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 69 | my $level=0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | $do = sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | 342 | ▶ | my ($expr, $lhs, $arg_of) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=65 SCAR=45.2
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 342 | for (ref $expr) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 342 | ▶ | ($_ eq '' or blessed($expr)) && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$_ eq "" or builtin::blessed($expr)
MC/DC100%2/2
$_ eq "" or builtin::blessed($expr)
$_ eq ""
builtin::blessed($expr)
Truth table100%3/3
A or B
A= $_ eq ""B= builtin::blessed($expr)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 111 | ▶ | if (defined $expr) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | # literal (value?) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 111 | ▶ | return $self->{config}{bind} ? [ -bind => $expr ] : $expr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | puke "undef not interpretable"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 231 | ▶ | /REF|SCALAR/ && do { # literals | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 22 | ▶ | if ($_ eq 'SCALAR') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 17 | return [-thing => $$expr] ; # never bind | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | elsif (ref $$expr eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | # very SQL:A thing, but we'll do it | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 5 | my @a = @$$expr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 5 | my $thing = shift @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 5 | @a = map { $self->_quote_lit($_) } @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 5 | ▶ | if ($self->{config}{bind}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | push @{$self->{bind_values}}, @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 5 | ▶ | if ($self->{config}{anon_placeholder}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 4 | ($thing =~ s/\Q$$self{config}{anon_placeholder}\E/$_/) for @a; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 5 | ▶ | return $lhs ? [-thing => $lhs, [-thing => $thing]] : [-thing => $thing]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 209 | ▶ | /ARRAY/ && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 32 | ▶ | if ($is_op->($$expr[0],'infix_distributable')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | # handle implicit equality pairs in an array | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | 12 | my $op = shift @$expr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 12 | my (@args,@flat); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | # flatten | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 12 | ▶ | if (@$expr == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 3 | for (ref($$expr[0])) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 3 | ▶ | /ARRAY/ && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 3 | @flat = @{$$expr[0]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 3 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | /HASH/ && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | @flat = %{$$expr[0]}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | last; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | puke 'Huh?'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | 9 | @flat = @$expr; # already flat | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | 12 | ▶ | while (@flat) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | 25 | my $elt = shift @flat; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | # $DB::single=1 if !defined($elt); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | 25 | ▶ | if (!ref $elt) { # scalar means lhs of a pair or another op | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | 14 | push @args, $do->({$elt => shift @flat},$lhs,$op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | 11 | ▶ | next if (ref $elt eq 'ARRAY') && ! scalar @$elt or | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition77%7/9
ref $elt eq "ARRAY" and not scalar @$elt or ref $elt eq "HASH" and not scalar %$elt
ref $elt eq "ARRAY" and not scalar @$elt
ref $elt eq "HASH" and not scalar %$elt
MC/DC25%1/4
ref $elt eq "ARRAY" and not scalar @$elt or ref $elt eq "HASH" and not scalar %$elt
ref $elt eq "ARRAY"
not scalar @$elt
ref $elt eq "HASH"
not scalar %$elt
Truth table28%2/7
A and not(B) or C and not(D)
A= ref $elt eq "ARRAY"B= not scalar @$eltC= ref $elt eq "HASH"D= not scalar %$elt
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | (ref $elt eq 'HASH') && ! scalar %$elt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | 10 | push @args, $do->($elt,$lhs,$op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 12 | return [$op => @args]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | 20 | ▶ | if ($is_op->($$expr[0]) and !$is_op->($$expr[0],'infix_distributable')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
&$is_op($expr->[0]) and not &$is_op($expr->[0], "infix_distributable")
MC/DC50%1/2
&$is_op($expr->[0]) and not &$is_op($expr->[0], "infix_distributable")
&$is_op($expr->[0])
not &$is_op($expr->[0], "infix_distributable")
Truth table66%2/3
A and not(B)
A= &$is_op($expr->[0])B= not &$is_op($expr->[0], "infix_distributable")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | # some other op | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | return [ $$expr[0] => map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 4 | $do->($_,undef,$$expr[0]) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } @$expr[1..$#$expr] ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | elsif (ref $$expr[0] eq 'HASH') { #? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | return [ $self->{config}{array_op} => | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 3 | map { $do->($_,$lhs,$self->{config}{array_op}) } @$expr ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | else { # is a plain list | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | 13 | ▶ | if ($lhs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | # implicit equality over array default op | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | return [ $self->{config}{array_op} => map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 4 | defined() ? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | [ $self->{config}{implicit_eq_op} => $lhs, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | 13 | ▶ | $do->($_,undef,$self->{config}{implicit_eq_op}) ] : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | [ -is_null => $lhs ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | } @$expr ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | 9 | ▶ | if ($arg_of and any { $is_op->($arg_of, $_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
Condition66%2/3
$arg_of and &any(sub {
&$is_op($arg_of, $_);
}
, "function", "infix_listarg", "predicate", "reduce")
MC/DC0%0/2
$arg_of and &any(sub {
&$is_op($arg_of, $_);
}
, "function", "infix_listarg", "predicate", "reduce")
$arg_of
&any(sub {
&$is_op($arg_of, $_);
}
, "function", "infix_listarg", "predicate", "reduce")
Truth table33%1/3
A and B
A= $arg_ofB= &any(sub {
&$is_op($arg_of, $_);
}
, "function", "infix_listarg", "predicate", "reduce")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | qw/function infix_listarg predicate reduce/ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | # function argument - return list itself | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 6 | return [ -list => map { $do->($_) } @$expr ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | # distribute $array_op over implicit equality | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | 3 | return $do->([ $self->{config}{array_op} => @$expr ]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | 177 | ▶ | /HASH/ && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 177 | my @k = keys %$expr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | ####### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 177 | ▶ | if (@k == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 154 | my $k = $k[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | # single hashpair | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 154 | ▶ | if ($is_op->($k)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | 59 | ▶ | $is_op->($k,'infix_binary') && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 33 | ▶ | puke "Expected LHS for $k" unless $lhs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 33 | ▶ | if (ref $$expr{$k} eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | # apply binary operator and join with array default op | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | return [ $self->{config}{array_op} => map { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | defined() ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | [ $k => $lhs, $do->($_)] : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | { $self->{config}{ineq_op} => [-is_not_null => $lhs], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | $self->{config}{implicit_eq_op} => [-is_null => $lhs] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 2 | ▶ | }->{$k} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 1 | } @{$$expr{$k}} ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | elsif (defined $$expr{$k}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 29 | return [ $k => $lhs, $do->($$expr{$k},undef,$k) ]; #? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | else { # IS (NOT) NULL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | 3 | ▶ | $k eq $self->{config}{ineq_op} && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 3 | return [ -is_not_null => $lhs ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | $k eq $self->{config}{implicit_eq_op} && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | return [ -is_null => $lhs ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | puke "Can't handle undef as argument to $k"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 26 | ▶ | $is_op->($k,'function') && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | 6 | return [ $k => $do->($$expr{$k},undef,$k) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 20 | ▶ | $is_op->($k,'infix_listarg') && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 4 | return [ $k => $lhs, $do->($$expr{$k},undef,$k) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 16 | ▶ | $is_op->($k,'prefix') && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 8 | return [ $k => $do->($$expr{$k}) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | 8 | ▶ | $is_op->($k,'infix_distributable') && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 4 | ▶ | if (!ref $$expr{$k} && $lhs) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition33%1/3
not ref $expr->{$k} and $lhs
MC/DC0%0/2
not ref $expr->{$k} and $lhs
not ref $expr->{$k}
$lhs
Truth table33%1/3
not(A) and B
A= not ref $expr->{$k}B= $lhs
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | return [ $k => $lhs, $do->($$expr{$k}) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | elsif ( ref $$expr{$k} eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 1 | my @ar = %{$$expr{$k}}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 1 | return $do->([$k=>@ar]); #? | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | elsif ( ref $$expr{$k} eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 3 | return $do->([$k => $$expr{$k}]); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | puke "arg type '".ref($$expr{$k})."' not expected for op '$k'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | 4 | ▶ | $is_op->($k,'predicate') && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | puke "predicate function '$k' requires an length 3 arrayref argument" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | 2 | ▶ | unless ref $$expr{$k} eq 'ARRAY' and @{$$expr{$k}} == 3; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $expr->{$k} eq "ARRAY" and @{$expr->{$k};} == 3
MC/DC0%0/2
ref $expr->{$k} eq "ARRAY" and @{$expr->{$k};} == 3
ref $expr->{$k} eq "ARRAY"
@{$expr->{$k};} == 3
Truth table33%1/3
A and B
A= ref $expr->{$k} eq "ARRAY"B= @{$expr->{$k};} == 3
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | return [ $k => [-thing => $$expr{$k}->[0]], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | $do->($$expr{$k}->[1], undef, $k), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 2 | $do->($$expr{$k}->[2], undef, $k) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | 2 | ▶ | $is_op->($k,'reduce') && do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | puke "reduce function '$k' requires an length 5 arrayref argument" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 2 | ▶ | unless ref $$expr{$k} eq 'ARRAY' and @{$$expr{$k}} == 5; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $expr->{$k} eq "ARRAY" and @{$expr->{$k};} == 5
MC/DC0%0/2
ref $expr->{$k} eq "ARRAY" and @{$expr->{$k};} == 5
ref $expr->{$k} eq "ARRAY"
@{$expr->{$k};} == 5
Truth table33%1/3
A and B
A= ref $expr->{$k} eq "ARRAY"B= @{$expr->{$k};} == 5
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | return [ $k => [-thing => $$expr{$k}->[0]], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | $do->($$expr{$k}->[1], undef, $k), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | [-thing => $$expr{$k}->[2]], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | $do->($$expr{$k}->[3], undef, $k), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 2 | $do->($$expr{$k}->[4], undef, $k)]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | puke "Operator $k not expected"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | ▶ | elsif (ref($$expr{$k}) && ref($$expr{$k}) ne 'SCALAR') { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
ref $expr->{$k} and ref $expr->{$k} ne "SCALAR"
MC/DC100%2/2
ref $expr->{$k} and ref $expr->{$k} ne "SCALAR"
ref $expr->{$k}
ref $expr->{$k} ne "SCALAR"
Truth table100%3/3
A and B
A= ref $expr->{$k}B= ref $expr->{$k} ne "SCALAR"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | # $k is an LHS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 38 | return $do->($$expr{$k}, $k, undef); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | # implicit equality | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | return defined $$expr{$k} ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | [ $self->{config}{implicit_eq_op} => $k, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | 57 | ▶ | $do->($$expr{$k},undef,$self->{config}{implicit_eq_op}) ] : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | [ -is_null => $k ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | ####### | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | # >1 hashpair | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | 23 | my @args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | 23 | for my $k (@k) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | # all keys are ops, or none is - otherwise barf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 52 | ▶ | if ( $is_op->($k, 'infix_binary') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 6 | ▶ | puke "No LHS provided for implicit $$self{config}{hash_op}" unless defined $lhs; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 6 | push @args, $do->({$k => $$expr{$k}},$lhs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | ▶ | elsif ( $is_op->($k, 'prefix') || $is_op->($k,'function') ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
&$is_op($k, "prefix") or &$is_op($k, "function")
MC/DC50%1/2
&$is_op($k, "prefix") or &$is_op($k, "function")
&$is_op($k, "prefix")
&$is_op($k, "function")
Truth table66%2/3
A or B
A= &$is_op($k, "prefix")B= &$is_op($k, "function")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 3 | push @args, [ $k => $do->($$expr{$k},undef, $k) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | elsif (!$is_op->($k)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | 43 | push @args, $do->({$k => $$expr{$k}}); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | puke "Problem handling operator '$k'"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 23 | return [ $self->{config}{hash_op} => @args ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | 69 | }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 69 | $ret = $do->($expr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | 69 | return $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | # peel - recurse $args = [ -op, @args ] to create complete production | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | sub peel { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 437 | ▶ | my ($self, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
peel: called CC=8 SCAR=21.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | 437 | ▶ | if (!defined $args) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | ▶ | elsif (!ref $args or blessed($args)) { # single literal argument | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
not ref $args or builtin::blessed($args)
MC/DC100%2/2
not ref $args or builtin::blessed($args)
not ref $args
builtin::blessed($args)
Truth table100%3/3
not(A) or B
A= not ref $argsB= builtin::blessed($args)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 189 | return $args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | elsif (ref $args eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | 248 | ▶ | return '' unless (@$args); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | 248 | my $op = shift @$args; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 248 | ▶ | puke "'$op' : unknown operator" unless $self->{dispatch}{$op}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 248 | my $expr = $self->_dispatch( $op, [map { $self->peel($_) } @$args] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 248 | ▶ | if (grep /\Q$op\E/, @{$type_table{infix_distributable}}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | # group | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 34 | return "($expr)" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 214 | return $expr; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | puke "Can only peel() arrayrefs, scalars or literals"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | ### writers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | sub infix_binary { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | 76 | ▶ | my ($self, $op, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
infix_binary: called CC=6 SCAR=24.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | 76 | ▶ | unless ($op and $args and !ref($op) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$op and $args and not ref $op and ref $args eq "ARRAY"
$op and $args and not ref $op
$op and $args
MC/DC0%0/4
$op and $args and not ref $op and ref $args eq "ARRAY"
$op
$args
not ref $op
ref $args eq "ARRAY"
Truth table20%1/5
A and B and not(C) and D
A= $opB= $argsC= not ref $opD= ref $args eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | and ref($args) eq 'ARRAY'){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | puke "arg1 must be scalar, arg2 must be arrayref"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 76 | ▶ | unless ( @$args == 2 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | puke "For $op, arg2 must have length 2"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 76 | return '('.join(" ", $$args[0], _write_op($op), $$args[1]).')'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 3 | ▶ | sub infix_listarg { infix_binary(@_) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
infix_listarg: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | sub infix_distributable { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 35 | ▶ | my ($self, $op, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
infix_distributable: called CC=5 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | 35 | ▶ | unless ($op and $args and !ref($op) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$op and $args and not ref $op and ref $args eq "ARRAY"
$op and $args and not ref $op
$op and $args
MC/DC0%0/4
$op and $args and not ref $op and ref $args eq "ARRAY"
$op
$args
not ref $op
ref $args eq "ARRAY"
Truth table20%1/5
A and B and not(C) and D
A= $opB= $argsC= not ref $opD= ref $args eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | and ref($args) eq 'ARRAY'){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | puke "arg1 must be scalar, arg2 must be arrayref"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | 35 | $op = _write_op($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 35 | return join(" $op ", @$args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | sub prefix { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | 12 | ▶ | my ($self, $op, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
prefix: called CC=6 SCAR=24.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | 12 | ▶ | unless ($op and $args and !ref($op) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$op and $args and not ref $op and ref $args eq "ARRAY"
$op and $args and not ref $op
$op and $args
MC/DC0%0/4
$op and $args and not ref $op and ref $args eq "ARRAY"
$op
$args
not ref $op
ref $args eq "ARRAY"
Truth table20%1/5
A and B and not(C) and D
A= $opB= $argsC= not ref $opD= ref $args eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | and ref($args) eq 'ARRAY'){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | puke "arg1 must be scalar, arg2 must be arrayref"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 12 | ▶ | unless (@$args == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | puke "For $op, arg2 must have length 1" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 12 | return _write_op($op)." ".$$args[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | sub postfix { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 6 | ▶ | my ($self, $op, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
postfix: called CC=6 SCAR=24.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 6 | ▶ | unless ($op and $args and !ref($op) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$op and $args and not ref $op and ref $args eq "ARRAY"
$op and $args and not ref $op
$op and $args
MC/DC0%0/4
$op and $args and not ref $op and ref $args eq "ARRAY"
$op
$args
not ref $op
ref $args eq "ARRAY"
Truth table20%1/5
A and B and not(C) and D
A= $opB= $argsC= not ref $opD= ref $args eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | and ref($args) eq 'ARRAY'){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | puke "arg1 must be scalar, arg2 must be arrayref"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 6 | ▶ | unless (@$args == 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | puke "For $op, arg2 must have length 1" | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 6 | return $$args[0]." "._write_op($op); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | sub function { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 6 | ▶ | my ($self, $op, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
function: called CC=5 SCAR=21.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | 6 | ▶ | unless ($op and $args and !ref($op) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$op and $args and not ref $op and ref $args eq "ARRAY"
$op and $args and not ref $op
$op and $args
MC/DC0%0/4
$op and $args and not ref $op and ref $args eq "ARRAY"
$op
$args
not ref $op
ref $args eq "ARRAY"
Truth table20%1/5
A and B and not(C) and D
A= $opB= $argsC= not ref $opD= ref $args eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | and ref($args) eq 'ARRAY'){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | puke "arg1 must be scalar, arg2 must be arrayref"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 6 | return _write_op($op).'('.join(',',@$args).')'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | sub predicate { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | 2 | ▶ | my ($self, $op, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
predicate: called CC=6 SCAR=24.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 2 | ▶ | unless ($op and $args and !ref($op) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$op and $args and not ref $op and ref $args eq "ARRAY"
$op and $args and not ref $op
$op and $args
MC/DC0%0/4
$op and $args and not ref $op and ref $args eq "ARRAY"
$op
$args
not ref $op
ref $args eq "ARRAY"
Truth table20%1/5
A and B and not(C) and D
A= $opB= $argsC= not ref $opD= ref $args eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | and ref($args) eq 'ARRAY'){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | puke "arg1 must be scalar, arg2 must be arrayref"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 2 | ▶ | unless ( @$args == 3 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | puke "For $op, arg2 must have length 3"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | 2 | return _write_op($op)."("."$$args[0] IN $$args[1] WHERE $$args[2]".")"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | sub extract { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | ▶ | my ($self, $op, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
extract: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | ▶ | unless ($op and $args and !ref($op) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/9
$op and $args and not ref $op and ref $args eq "ARRAY"
$op and $args and not ref $op
$op and $args
MC/DC0%0/4
$op and $args and not ref $op and ref $args eq "ARRAY"
$op
$args
not ref $op
ref $args eq "ARRAY"
Truth table0%0/5
A and B and not(C) and D
A= $opB= $argsC= not ref $opD= ref $args eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | and ref($args) eq 'ARRAY'){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | puke "arg1 must be scalar, arg2 must be arrayref"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | ▶ | unless ( @$args == 3 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | puke "For $op, arg2 must have length 3"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | return _write_op($op)."("."$$args[0] IN $$args[1] | $$args[2]".")"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | sub reduce { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | 2 | ▶ | my ($self, $op, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reduce: called CC=6 SCAR=24.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | 2 | ▶ | unless ($op and $args and !ref($op) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$op and $args and not ref $op and ref $args eq "ARRAY"
$op and $args and not ref $op
$op and $args
MC/DC0%0/4
$op and $args and not ref $op and ref $args eq "ARRAY"
$op
$args
not ref $op
ref $args eq "ARRAY"
Truth table20%1/5
A and B and not(C) and D
A= $opB= $argsC= not ref $opD= ref $args eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | and ref($args) eq 'ARRAY'){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | puke "arg1 must be scalar, arg2 must be arrayref"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 2 | ▶ | unless ( @$args == 5 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | 0 | puke "For $op, arg2 must have length 5"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | 2 | return _write_op($op)."("."$$args[0] = $$args[1], $$args[2] IN $$args[3] | $$args[4]".")"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | # bind either: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | # - pulls out literals, pushes them into {bind_values}, and replaces them | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | # with '?' in the produced statement (a la SQL:A), -or- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | # - identifies named parameters in the expression and pushes these into | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | # {parameters}, leaving them in the produced statement | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | sub bind { # special | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | 81 | ▶ | my ($self, $op, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bind: called CC=8 SCAR=27.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | 81 | ▶ | unless ($op and $args and !ref($op) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$op and $args and not ref $op and ref $args eq "ARRAY"
$op and $args and not ref $op
$op and $args
MC/DC0%0/4
$op and $args and not ref $op and ref $args eq "ARRAY"
$op
$args
not ref $op
ref $args eq "ARRAY"
Truth table20%1/5
A and B and not(C) and D
A= $opB= $argsC= not ref $opD= ref $args eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | and ref($args) eq 'ARRAY'){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | 0 | puke "arg1 must be scalar, arg2 must be arrayref"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | 81 | ▶ | if ($$args[0] =~ $self->{config}{parameter_sigil}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | push @{$self->{parameters}}, $$args[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | 81 | ▶ | push @{$self->{bind_values}}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | 81 | $self->{config}{anon_placeholder} ? $$args[0] : | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | $self->_quote_lit($$args[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | return $self->{config}{anon_placeholder} ? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | $self->{config}{anon_placeholder} : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 81 | ▶ | $self->_quote_lit($$args[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | sub list { # special | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 5 | ▶ | my ($self, $op, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
list: called CC=5 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | 5 | ▶ | unless ($op and $args and !ref($op) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%3/9
$op and $args and not ref $op and ref $args eq "ARRAY"
$op and $args and not ref $op
$op and $args
MC/DC0%0/4
$op and $args and not ref $op and ref $args eq "ARRAY"
$op
$args
not ref $op
ref $args eq "ARRAY"
Truth table20%1/5
A and B and not(C) and D
A= $opB= $argsC= not ref $opD= ref $args eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | and ref($args) eq 'ARRAY'){ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | puke "arg1 must be scalar, arg2 must be arrayref"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 5 | my ($l,$r) = split '',$self->{config}{list_braces}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | 5 | return $l.join(',',@$args).$r; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | sub thing { # special | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 29 | ▶ | my ($self, $op, $args) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
thing: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | 29 | return join(' ',@$args); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | sub _write_op { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | 139 | ▶ | my ($op) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_write_op: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 139 | $op =~ s/^-//; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | 139 | my $c = (caller(1))[3]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | 139 | ▶ | return '' if ($op eq '()'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 139 | ▶ | return join(' ', map { ($c=~/infix|prefix|postfix/) ? uc $_ : $_ } split /_/,$op); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | Neo4j::Cypher::Abstract::Peeler - Parse Perl structures as expressions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | C<Neo4j::Cypher::Abstract::Peeler> allows the user to write L<Neo4j | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | Cypher|https://neo4j.com/docs/developer-manual/current/cypher/> query | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | language expressions as Perl data structures. The interpretation of | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | data structures follows L<SQL::Abstract> very closely, but attempts to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | be more systematic and general. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | C<Peeler> only produces expressions, typically used as arguments to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | C<WHERE> clauses. It is integrated into L<Neo4j::Cypher::Abstract>, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | which produces full Cypher statements. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | Like L<SQL::Abstract>, C<Peeler> translates scalars, scalar refs, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | array refs, and hash refs syntactically to create expression | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | components such as functions and operators. The contents of the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | scalars or references are generally operators or the arguments to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | operators or functions. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | Contents of scalar references are always treated as literals and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | inserted into the expression verbatim. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | =item * Functions | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | Ordinary functions in Cypher are written as the name of the function | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | preceded by a dash. They can be expressed as follows: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | { -func => $arg } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | [ -func => $arg ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | \"func($arg)" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | { -sin => $pi/2 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | # returns sin(<value of $pi>/2) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | =item * Infix Operators | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | Infix operators, like equality (C<=>), inequality (C<E<lt>E<gt>>), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | binary operations (C<+,-,*,/>), and certain string operators | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | (C<-contains>, C<-starts_with>, C<ends_with>) are expressed as follows: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | { $expr1 => { $infix_op => $expr2 } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | { 'n.name' => { '<>' => 'Fred' } } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | # returns n.name <> "Fred" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | This may seem like overkill, but comes in handy for... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | =item * AND and OR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | C<Peeler> implements the L<SQL::Abstract> convention that hash refs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | represent conditions joined by C<AND> and array refs represent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | conditions joined by C<OR>. Key-value pairs and array value pairs are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | interpreted as an implicit equalities to be ANDed or ORed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | { $lhs1 => $rhs1, $lhs2 => $rhs2 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | { al => 'king', 'eddie' => 'prince', vicky => 'queen' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | # returns al = "king" AND eddie = "prince" AND vicky = "queen" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | [ $lhs1 => $rhs1, $lhs2 => $rhs2 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | [ 'a.name' => 'Fred', 'a.name' => 'Barney'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | # returns a.name = "Fred" OR a.name = "Barney" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | A single left-hand side can be "distributed" over a set of conditions, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | with corresponding conjunction: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | { zzyxx => [ 'narf', 'boog', 'frelb' ] } # implicit equality, OR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | # returns zzyxx = "narf" OR zzyxx = "boog" OR zzyxx = "frelb" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | { zzyxx => { '<>' => 'narf', '<>' => 'boog' } } # explicit infix, AND | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | # returns zzyxx <> "narf" AND zzyxx <> "boog" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | { zzyxx => [ '<>' => 'narf', -contains => 'boog' ] } # explicit infix, OR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | # returns zzyxx <> "narf" OR zzyxx CONTAINS "boog" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | =item * Expressing null | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | C<undef> can be used to express NULL mostly as in L<SQL::Abstract> so | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | that the following are equivalent | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | { a.name => { '<>' => undef}, b.name => undef} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | { -is_not_null => 'a.name', -is_null => 'b.name' } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | # returns a.name IS NOT NULL AND b.name IS NULL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | =item * Predicates: -all, -any, -none, -single, -filter | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | These Cypher functions have the form | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | func(variable IN list WHERE predicate) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | To render these, provide an array ref of the three arguments in order: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | { -all => ['x', [1,2,3], {'x' => 3}] } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | # returns all(x IN [1,2,3] WHERE x = 3) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | =item * List arguments | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | For cypher expressions that accept lists (arrays in square brackets), use arrayrefs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | { 'n.name' => { -in => ['fred','wilma','pebbles'] }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | # returns n.name IN ['fred','wilma','pebbles'] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | =head2 Parameters and Bind Values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | Cypher parameters (which use the '$' sigil) may be included in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | expressions (with the dollar sign appropriately escaped). These are | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | collected during parsing and can be reported in order with the the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | C<parameters()> method. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | L<SQL::Abstract> automatically collects literal values and replaces | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | them with anonymous placeholders (C<?>), returning an array of values | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | for binding in L<DBI>. C<Peeler> will collect values and report them | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | with the C<bind_values()> method. If the config key | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | C<anon_placeholder> is set: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | $peeler->{config}{anon_placeholder} = '?' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | then C<Peeler> will also do the replacement in the final expression | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | production like L<SQL::Abstract>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | The real reason to pay attention to literal values is to be able to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | appropriately quote them in the final production. When | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | C<anon_placeholder> is not set (default), then an attempt is made to | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | correctly quote string values and such. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | =head1 GUTS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | TBD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | =head2 The config hash | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | TBD | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | =over | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | =item express() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | Canonize, then peel. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | =item canonize() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | Render SQL:A-like expression into a canonical lisp-like array tree. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | =item peel() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | Render a canonical tree as a Cypher string expression | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | =item parameters() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | Get a list in order of all named parameters. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | =item bind_values() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | Get a list of bind values in order that were replaced by the anonymous | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | placeholder. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | =head1 SEE ALSO | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | L<Neo4j::Cypher::Abstract>, L<SQL::Abstract>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | Mark A. Jensen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | CPAN: MAJENSEN | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | majensen -at- cpan -dot- org | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | (c) 2017 Mark A. Jensen | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||