Skip to content

Commit

Permalink
Reduce warnings introduced in 450e6db to one per callsite
Browse files Browse the repository at this point in the history
  • Loading branch information
ribasushi committed Dec 27, 2010
1 parent 8592e2d commit 43da768
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Changes
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ Revision history for DBIx::Class
pairs of column name/info at once
- $rs->search now throws when called in void context, as it makes
no sense (and is nearly always a sign of a bug/misdesign)
- Deprecate legacy $rs->search( %condition ) syntax
- Deprecate legacy $rs->search( %condition ) syntax (warn once per
callsite)
- NULL is now supplied unquoted to all debug-objects, in order to
differentiate between a real NULL and the string 'NULL'
- New search() condition operator -value used to pass complex bind
Expand Down
14 changes: 12 additions & 2 deletions lib/DBIx/Class/ResultSet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ always return a resultset, even in list context.
=cut

my $callsites_warned;
sub search_rs {
my $self = shift;

Expand Down Expand Up @@ -370,8 +371,17 @@ sub search_rs {

} if @_;

carp 'search( %condition ) is deprecated, use search( \%condition ) instead'
if (@_ > 1 and ! $self->result_source->result_class->isa('DBIx::Class::CDBICompat') );
if( @_ > 1 and ! $self->result_source->result_class->isa('DBIx::Class::CDBICompat') ) {
# determine callsite obeying Carp::Clan rules (fucking ugly but don't have better ideas)
my $callsite = do {
my $w;
local $SIG{__WARN__} = sub { $w = shift };
carp;
$w
};
carp 'search( %condition ) is deprecated, use search( \%condition ) instead'
unless $callsites_warned->{$callsite}++;
}

for ($old_where, $call_cond) {
if (defined $_) {
Expand Down

0 comments on commit 43da768

Please sign in to comment.