[Maypole] Help with M::M::CDBI::Plain (finish is in sight!)

Jesse Sheidlower jester@panix.com
Sat, 17 Jul 2004 20:25:20 -0400


On Sat, Jul 17, 2004 at 03:54:25PM -0400, Jesse Sheidlower wrote:
> On Sat, Jul 17, 2004 at 02:14:53PM +0100, Simon Cozens wrote:
> 
> The problem I get with wrapping the setup stuff in a BEGIN
> block is: 
> 
>  [error] Can't locate object method "table" via package
> "sfDB::Citation" (perhaps you forgot to load
> "sfDB::Citation"?) at
> /usr/local/lib/perl5/site_perl/5.8.4/Maypole/Model/CDBI/Plain.pm
> line 6
> 
> Perhaps the problem with the order of loading can be solved
> simply by moving the "use sfDB::Citation" etc. statements
> _after_ the
> 
> sfDB->config->{model} = "Maypole::Model::CDBI::Plain";
> sfDB->setup([qw/sfDB::Citation sfDB::CitationSubject sfDB::Subject/]);
> 
> lines (but _without_ wrapping these in a BEGIN block)? I also fixed a
> problem that caused another error (I, er, forget the set_up_table
> call in my derived classes).
> 
> This seems to fix order-of-loading issues. There is one
> remaining error, though, that I have no idea the source of:
> 
> [Sat Jul 17 15:31:54 2004] [error] No such column: model_class
> 
> That's the entire error.

I correct myself, I've been confusing a variety of errors.
This error--the "No such column: model_class"--comes _only_
from adding M::M::CDBI::Plain to the "use base" list for the
derived modules, the first of the two suggested solutions
Simon offered.

Now, any version _without_ M::M::CDBI::Plain in the derived
modules, or a BEGIN block in the base module, throws the
"Invalid CODE attribute: Exported" error, whether the "use
sfDB::Citation" lines precede or follow the "setup" call.

When there is a BEGIN block wrapping the setup call in the
base module, I get the "Invalid CODE attribute" error if
the "use sfDB::Citation" etc. lines _precede_ the BEGIN
block, but if these lines _follow_ the BEGIN block--the other
of the two solutions Simon suggested in his previous message--
I get a 

 [error] Can't locate object method "table" via package
"sfDB::Citation" (perhaps you forgot to load
"sfDB::Citation"?) at
/usr/local/lib/perl5/site_perl/5.8.4/Maypole/Model/CDBI/Plain.pm
line 6

error.

I have tried to look over the Buscador example, and it is 
a little different from either the ::Plain docs, or
what Simon had been suggesting. It also looked pretty
cool, and I was especially blown away by the
    $r->objects([ $self->plucene_search( $r->{query}{terms} )]); 
search method--wow! But, in any event, following this
pattern also leads to the "can't locate..."table"...perhaps
you forgot to load sfDB::Citation" error as above.

C'mon, no one else using this yet? I'm tearing my hair out here!

Jesse Sheidlower