On 11/8/05, Kieren Diment <[EMAIL PROTECTED]> wrote:
> To start refactoring my application, I started by refactoring BeerDB
> and wrote it up. The updated pod is on the wiki.  The new section is
> below.  I would appreciate comments or suggestions.
>
> A couple of questions though.
>
> I note from the documentation in Maypole::Model::CDBI::Plain that
> (for the BeerDB) we're asked to create our model classes in
> BeerDB::Beer, BeerDB::Style etc.  What If I don't want to do that?
> How do I configure CDBI::Plain/Maypole to look for say the classes qw/
> Beer Beer::Brewery Beer::Style/ etc?
>

I dont see this doc in 2.09 . All i see is

This module allows you to use Maypole with previously set-up
L<Class::DBI> classes; simply call C<setup> with a list reference
of the classes you're going to use, and Maypole will work out the
tables and set up the inheritance relationships as normal.

Did you try it and it not work?


> My brief experiment showed me that the untaint statements :q
don't work
> if they're moved into the model classes, so for example the statement
>
> BeerDB::Brewery->untaint_columns( printable => [qw/name notes url/]);
>
> in Brewery.pm doesn't work (the error message is something like:
>
> BeerDB::Beer can't load BeerDB::Brewery: Can't locate object method
> "untaint_columns" via package "BeerDB::Brewery" at /usr/local/src/
> beer/lib//BeerDB/Brewery.pm line 6.\nCompilation failed in require
> at /Library/Perl/5.8.6/Class/DBI.pm line 1208. at /Library/Perl/5.8.6/
> Class/DBI/Relationship/HasA.pm line 22\nCompilation failed in require
> at /usr/local/src/beer/lib//BeerDB.pm line 3.\nBEGIN failed--
> compilation aborted at /usr/local/src/beer/lib//BeerDB.pm line 3.
> \nCompilation failed in require at (eval 19) line 3.\n
>

This is because you "use" the classes before setup is called.   It
does not know about untaint_columns because your modules have not yet
been adopted by the base class which uses FromCGI.

You could
A) require your classes after setup like a normal app. Not sure why
docls are like that. Probably because you have to load the modules
first before they can be adopted. Therefore A probably wont work :)

B) Put Class::DBI::FromCGI/AsForm statements in all your modules. 
This is probably what is intended. I think the idea is that all your
modules are already built and funcioining and you just want to add
them into the Maypole app.  How about Exported actions though?  What
if you have Exported actions before setup is called ?  does it die?

Not sure though.


cheers
---
pjs


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Maypole-users mailing list
Maypole-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/maypole-users

Reply via email to