From: Matt S Trout Date: Wed, 27 Mar 2019 01:15:05 +0000 (+0000) Subject: simplify Default_Scalar_to code X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c349b7502d27a727a9d4a63f13a7ac1ae2dad67a;p=scpubgit%2FQ-Branch.git simplify Default_Scalar_to code --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 343f1f5..2661082 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -555,6 +555,8 @@ sub where { return wantarray ? ($sql, @bind) : $sql; } +{ our $Default_Scalar_To = -value } + sub expand_expr { my ($self, $expr, $default_scalar_to) = @_; local our $Default_Scalar_To = $default_scalar_to if $default_scalar_to; @@ -686,10 +688,7 @@ sub _expand_expr_hashpair_ident { sub _expand_expr_scalar { my ($self, $expr) = @_; - if (my $d = our $Default_Scalar_To) { - return $self->_expand_expr({ $d => $expr }); - } - return $self->_expand_value(-value => $expr); + return $self->_expand_expr({ (our $Default_Scalar_To) => $expr }); } sub _expand_expr_hashpair_scalar {