[Dbix-class] Overriding all()

Florian Ragwitz rafl at debian.org
Thu Jun 3 09:32:59 GMT 2010


On Thu, Jun 03, 2010 at 02:01:11AM -0700, Paul Makepeace wrote:
> This used to work, perhaps by accident of usage,
>
> package IDL::ResultSet::SiteTestimonial;
> use base 'DBIx::Class::ResultSet';
>
> sub all {
> 	my $self = shift;
> 	return $self->search(
> 		{ visible => 'Y' }, { order_by => 'sort desc' });
> }
>
> but now seeing a q[Deep recursion on subroutine
> "DBIx::Class::ResultSet::search"] error. What's the BP way of doing
> this?

->search, in list context, means ->search_rs->all. You're calling
->search in list context within your Rs->all method. That's why you end
up recursing indefinitely.


-- 
BOFH excuse #429:
Temporal anomaly
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.scsys.co.uk/pipermail/dbix-class/attachments/20100603/d1ed1fbf/attachment.pgp


More information about the DBIx-Class mailing list