[CDBI] has_many limiting the search.

Perrin Harkins perrin at elem.com
Sun Dec 10 13:23:05 GMT 2006


Praveen Hombaiah wrote:
> I understand I could do the following while using the Class,
> 
> my @cds = $artist->cds(in_stock => 'Y');
> 
> but I want this behavior to be default in the class, and not have the
> user do this.

I'd just do this:

sub cds_in_stock {
     my $self = shift;
     return $self->cds(in_stock => 'Y');
}

And then,

my @cds = $artist->cds_in_stock;

- Perrin



More information about the ClassDBI mailing list