From: Matt S Trout Date: Thu, 21 Mar 2019 05:03:54 +0000 (+0000) Subject: extract ident handling X-Git-Tag: v1.90_01~351 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=83de255f66b20f170aa154fd20a4294f277524b8;p=dbsrgits%2FSQL-Abstract.git extract ident handling --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 0d5586e..a3010e0 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -687,13 +687,10 @@ sub _expand_expr_hashpair { return $self->$x($op, $vv, $k); } if ($op eq 'ident') { - if (! defined $vv or (ref($vv) and ref($vv) eq 'ARRAY')) { - puke "-$op requires a single plain scalar argument (a quotable identifier) or an arrayref of identifier parts"; - } return +{ -op => [ $self->{cmp}, $self->_expand_ident(-ident => $k), - $self->_expand_ident(-ident => $vv), + $self->_expand_expr({ -ident => $vv }), ] }; } if ($op eq 'value') { @@ -818,7 +815,10 @@ sub _expand_expr_hashpair { } sub _expand_ident { - my ($self, undef, $body) = @_; + my ($self, $op, $body) = @_; + unless (defined($body) or (ref($body) and ref($body) eq 'ARRAY')) { + puke "$op requires a single plain scalar argument (a quotable identifier) or an arrayref of identifier parts"; + } my @parts = map split(/\Q${\($self->{name_sep}||'.')}\E/, $_), ref($body) ? @$body : $body; return { -ident => $parts[-1] } if $self->{_dequalify_idents};