[Dbix-class] search_rs needs to die?

Bill Moseley moseley at hank.org
Sun Jun 17 13:11:37 GMT 2012


I've been away from a project for a while and so first thing I did was run
its tests:

I'm seeing this warning triggered from RestulSet.pm:

  if( @_ > 1 and ! $rsrc->result_class->isa('DBIx::Class::CDBICompat') ) {
    carp_unique 'search( %condition ) is deprecated, use search(
\%condition ) instead';
  }

What I'm finding is that people have been passing multiple hash refs to
search().  For example,

$schema->resultset( 'Foo' )->search(
   \%criteria,
   {   join =3D> 'some_join' },
   {   prefetch =3D> [ {  one =3D> 'two' } ] },
);

The problem, of course, is not that search() was called with a hash, but
that it was called incorrectly.

It looks to me like search_rs assumes there's two arguments passed with
$_[-1] being the \%attrs.   If that's the case should search_rs die up
front if passed more than two arguments where the first argument looks like
a hashref (\%criteria) or it is undefined?


-- =

Bill Moseley
moseley at hank.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20120617/b9a=
e52db/attachment.htm


More information about the DBIx-Class mailing list