Re: [CDBI] has_many limiting the search.

Perrin Harkins <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.class-dbi
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.