[Catalyst] subclassing model classes

matthew couchman (JIC) matthew.couchman at bbsrc.ac.uk
Tue Dec 15 11:32:37 GMT 2009


Hi,

I'm trying to subclass a model class so that when I search it only pulls out rows of a certain type. I thought that perhaps I could achieve that by overriding the search() function and adding a condition to the list of arguments as below:

package MyApp::Schema::Result::Vertex;

use strict;
use warnings;

use base 'MyApp::Schema::Result::Point';

# override search
sub search {
    my $self = shift;
    my $condition = { type => 'vertex' };
    return $self->next::method($condition, @_);
}

1;

I don't think that my new search function is ever called though. Do I need to override anything else or am I just barking up the wrong tree completely?

Thanks for your help,

                                                Matt.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20091215/5f968b5a/attachment.htm


More information about the Catalyst mailing list