On 9 Nov 2005, at 15:21, Peter Speltz wrote:

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?


According to my docs (I suppose 2.10, although I'm not suer) I'm supposed to:

           package Foo;
           use base 'Maypole::Application';
           use Foo::SomeTable;
           use Foo::Other::Table;

           Foo->config->model("Maypole::Model::CDBI::Plain");
           Foo->setup([qw/ Foo::SomeTable Foo::Other::Table /]);





My brief experiment showed me that the untaint statements don't work
[snip]
...  How about Exported actions though?  What
if you have Exported actions before setup is called ?  does it die?


Maybe this is symptomatic of the whole problem.  Indeed, when I add

sub test : Exported {
  # do nothing
}

to one of the CDBI classes, the whole thing dies with more invalid CODE attributes.

wrapping the call to setup in a begin block, or even doing:

package BeerDB;
use base 'Maypole::Application';
BEGIN {
    use BeerDB::Beer;
    use BeerDB::Brewery;
    use BeerDB::Handpump;
    use BeerDB::Pub;
    use BeerDB::Style;

    BeerDB->config->model('Maypole::Model::CDBI::Plain');
BeerDB->setup([qw/BeerDB::Beer BeerDB::Brewery BeerDB::Handpump BeerDB::Pub BeerDB::Style/]);
}

doesn't make any difference. What Dave said the other day about manipulating @ISA seems like it would be the go, but I'm not sure where or how to do that. At this stage my grasp of inheritance is still somewhat tenuous. There's a nice quote in perldoc perlobj: "Now you need just to go off and buy a book about object-oriented design methodology, and bang your forehead with it for the next six months or so."

What might be happening here is I might be proceeding towards the BeerDB and OfflineBeerDB models as expounded in Maypole::Manual::Inheritance, but I think if I'm going to write it up, I need to do take the whole Class::DBI::Loader-less approach first.

kd


-------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-users

Reply via email to