From: Matt S Trout Date: Wed, 27 Feb 2019 02:46:02 +0000 (+0000) Subject: cleaner DBIC detection and compat X-Git-Tag: v2.000000~3^2~418 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dc573b1098976a6ea7116a9639e49c3063bef799;p=dbsrgits%2FSQL-Abstract.git cleaner DBIC detection and compat --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 78f3ba5..f2e6ae0 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -160,10 +160,11 @@ sub new { # regexes are applied in order, thus push after user-defines push @{$opt{special_ops}}, @BUILTIN_SPECIAL_OPS; - if ($class =~ /^DBIx::Class::SQLMaker/) { + if ($class->isa('DBIx::Class::SQLMaker')) { push @{$opt{special_ops}}, our $DBIC_Compat_Op ||= { regex => qr/^(?:ident|value)$/i, handler => sub { die "NOPE" } }; + $opt{is_dbic_sqlmaker} = 1; } # unary operators @@ -567,8 +568,6 @@ sub _expand_expr { die "notreached"; } -my $Nest_Warned = 0; - sub _expand_expr_hashpair { my ($self, $k, $v, $logic) = @_; unless (defined($k) and length($k)) { @@ -587,8 +586,8 @@ sub _expand_expr_hashpair { if ($k eq '-nest') { # DBIx::Class requires a nest warning to be emitted once but the private # method it overrode to do so no longer exists - if (ref($self) =~ /^DBIx::Class::SQLMaker/) { - unless ($Nest_Warned) { + if ($self->{is_dbic_sqlmaker}) { + unless (our $Nest_Warned) { belch( "-nest in search conditions is deprecated, you most probably wanted:\n" .q|{..., -and => [ \%cond0, \@cond1, \'cond2', \[ 'cond3', [ col => bind ] ], etc. ], ... }|