Richard,
>
>I think you are mixing up the driver and model classes.
>
>You want your Driver to be like :
>
>package Foo;
>use 'Maypole::Application';
>
>Foo->config->model("Maypole::Model::CDBI::Plain");
>Foo->setup([qw/ Foo::SomeTable Foo::Other::Table /]);
>
>  ..
>
>  1;
>
>
>and your model classes to be like
>
>  package Foo::SomeTable
>  use base qw(Class::DBI);
>
>  ..
>
>  1;
>
>So your driver class is the one you specify as the mod_perl handler,
>and your model classes are your plain CDBI classes.
>


Hello Again,

  Thanks for the speedy responce. The example you provided is what I have 
done. My Driver class is as follows (again):


package BS::Actions::Provider;
use Maypole::Application;

     BS::Actions::Provider->config->model("Maypole::Model::CDBI::Plain");
     BEGIN{BS::Actions::Provider->setup([qw/BS::DB::Provider/]);}

     BS::DB::Provider->untaint_columns(printable => [qw/name/]);


     sub view : Exported {
         my ($class,$r) = @_;
         #get provider etc...
     }

where BS::DB::Provider is a Class::DBI subclass.
Initialy, when I didnt have the BEGIN block, i get an attribute error for 
the :Exported sub ("Invalid Code attribute : Exported at
...."). Several sites suggested adding the BEGIN. This worked, but bought up 
the following Class::DBI::Loader error:

Couldn't require loader class "Class::DBI::Loader::", "Can't locate
Class/DBI/Loader/.pm in @INC (...)

The problem is that the BEGIN block causes setup() to run before I set the 
underlying model() class, so the model class becomes Maypole::Model::CDBI by 
default. When this classes setup_database() is called, it expects a 
connection string to pass to Class::DBI::Loader. This string does not exist, 
and the call fails. As you can see in Loader's error message, the underlying 
loader is not given "Can't locate
Class/DBI/Loader/.pm in @INC"

Without the begin block, it would appear that  config would be setup 
accordingly. But then I get an error regarding the :Exported sub. The 
question might then become: "Why does my Exported sub generate this error: 
Invalid Code attribute : Exported at ...."



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Maypole-users mailing list
Maypole-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/maypole-users

Reply via email to