[Maypole] Trying to build new model class

Simon Cozens simon@simon-cozens.org
Fri, 7 May 2004 15:51:25 +0100


Andrew Findlay:
> I started by copying Maypole/Model/CDBI.pm and removing everything
> that looked specific to DBI. This became Dir/Model.pm
> 
> I also copied Class/DBI/Loader/Generic.pm to Dir/Loader/Generic.pm
> The only change to that so far is the module name.

I'm not sure that's a useful starting point.

> Class/DBI/Loader/mysql.pm was copied to Dir/Loader/LDAP.pm and
> modified.

Or that.

> I override some parts of the config hash in the main application
> class, to force Maypole to use Dir::Model rather than
> Maypole::Model::CDBI. I found that I had to specify
> view => "Maypole::View::TT" here too, which seems wrong.

That does seem wrong.

> sub class_of {
>     my ($self, $r, $table) = @_;
>     return $r->config->{loader}->_table2class($table);
> }
> 
> Obviously the loader stuff should have been filled in during the setup
> phase, but I cannot see where.

It should only be filled in if you're starting from Class::DBI::Loader.
But since your model is not Class::DBI-based in the slightest, I wouldn't
do that.

Basically, if you want to get there, I wouldn't be starting from here.

-- 
Testing can show the presence of bugs, but not their absence.
		-- Dijkstra