2008/11/26 Jacinta Richardson <[EMAIL PROTECTED]>:
> Aaron Trevena wrote:
>
>>> undef error - Can't locate object method "search_columns" via package
>>> "BeerDB::Pub" at /usr/share/perl5/Template/Plugin/Class.pm line 36.
>
>> it would be much quicker to just define a search_columns method in
>> BeerDB::Pub - all it needs to return is an array of field_names - 1
>> line of code - then you get all the other fixes to templates since
>> 2.10 (which is a lot)
>
> Now I can see how this works, but I'm left with wondering what the OO schema 
> for
> these classes is.  Going back to the example code: BeerDB.pm I begin to wonder
> if the modules that are springing into existence: BeerDB::Beer, BeerDB::Pub,
> BeerDB::Brewery and BeerDB::Handpump have an ISA relationship with BeerDB.  On
> one hand I can't imagine they wouldn't, on the other hand adding a
> search_columns sub to BeerDB hasn't worked, it's not being seen.
>
> # Not working :(
>
> package BeerDB;
>
> sub search_columns {
>        my $self = shift;
>        return $self->columns;
> }
>
> I'd rather not have to write:
>
> sub BeerDB::Beer::search_columns { return qw(abv name price notes url style
> brewery score) }
> sub BeerDB::Brewery::search_columns { return qw(name notes url) }
>
> etc etc.  Because that's repeating myself.  What if I want to change the name 
> of
> one of my columns?  Or add another?  What if I change a table name or add
> another?  That can't be a good answer.
>
> Is this the one-line answer you were thinking of, or is there a way to avoid
> repeating myself?

Currently it looks like you need to repeat yourself - search_columns
should be provided by the model base class, and clearly currently it
isn't.

That's a bug, sorry :( Should be able to fix it today, but won't be
available in release for a while as I'm in the middle of rejigging
models to handle working with DBIx::Class.

A.

-- 
http://www.aarontrevena.co.uk
LAMP System Integration, Development and Hosting

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Maypole-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-devel

Reply via email to