From: Matt S Trout Date: Mon, 17 Sep 2018 23:03:45 +0000 (+0000) Subject: add default for ident vs. value X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2558b62299e9c7b2e532ca5298660287db394f09;p=scpubgit%2FQ-Branch.git add default for ident vs. value --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index a819179..412e968 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -528,7 +528,8 @@ sub where { } sub _expand_expr { - my ($self, $expr, $logic) = @_; + my ($self, $expr, $logic, $default_scalar_to) = @_; + local our $Default_Scalar_To = $default_scalar_to if $default_scalar_to; return undef unless defined($expr); if (ref($expr) eq 'HASH') { if (keys %$expr > 1) { @@ -572,6 +573,9 @@ sub _expand_expr { return +{ -literal => $literal }; } if (!ref($expr) or Scalar::Util::blessed($expr)) { + if (my $d = $Default_Scalar_To) { + return +{ $d => $expr }; + } if (my $m = our $Cur_Col_Meta) { return +{ -bind => [ $m, $expr ] }; }