On 11/10/05, Kieren Diment <[EMAIL PROTECTED]> wrote:
>
> On 10 Nov 2005, at 10:35, Kieren Diment wrote:
>
> >>
> >
> > It worked when I used:
> >
> > use base qw/Maypole::Application Maypole::Model::CDBI::Plain
> > Class::DBI/; [in BeerDB::DBI].
>
> >
> >
> >
> > Thanks, this seemed to work (for now?).  And its only an hour and a
> > half through the working day!  Might even get CokeWorks refactored
> > properly now!
>
> OK, I said seemed to work.  So I started adding some complexity.
> Adding a user table to the database to get authentication running
> screwed things up.
>
> Using Maypole::Plugin::UserSessionCookie, I put in the authenticate
> sub from the docs, and added a user class with the default user and
> password fields to my model.  And lo and behold I get a login
> screen.  Going back to add a valid user to the database, and logging
> in, I'm greeted with a blank screen and the following in error.log
> (debugging switched on).
>
> user class: BeerDB::User at /Library/Perl/5.8.6/Maypole/Plugin/
> Authentication/UserSessionCookie.pm line 142.
> caught authenticate error: Can't locate object method "search" via
> package "BeerDB::User" (perhaps you forgot to load "BeerDB::User"?)
> at /Library/Perl/5.8.6/Maypole/Plugin/Authentication/
> UserSessionCookie.pm line 147.
> Can't locate object method "search" via package
> "BeerDB::User" (perhaps you forgot to load "BeerDB::User"?) at /
> Library/Perl/5.8.6/Maypole/Plugin/Authentication/UserSessionCookie.pm
> line 147.
> :  at /Library/Perl/5.8.6/Maypole.pm line 101
> Use of uninitialized value in concatenation (.) or string at /Library/
> Perl/5.8.6/Apache/MVC.pm line 58.
> Use of uninitialized value in length at /Library/Perl/5.8.6/Apache/
> MVC.pm line 64.
> Use of uninitialized value in subroutine entry at /Library/Perl/5.8.6/
> Apache/MVC.pm line 73.
>
>
> So there are still problems with the inheritance chain.
>
> Any ideas?

The use BeerDB::Beer etc statements are necessary, it just seems like
they're not. The call to setup(), among other things, adds the model
class to the @ISA of each class you pass in the setup() call. That act
automagically creates the BeerDB::Beer etc namespaces if they don't
already exist. So you can now call methods of BeerDB::Beer, and as
long as somewhere in the inheritance chain, the method is defined,
then BeerDB::Beer seems to work as expected. But you haven't actually
loaded/compiled and custom code in BeerDB/Beer.pm

At least, that's my latest theory. Under the plain model, somewhere,
it's up to you to ensure the code in the subclasses is compiled,
Maypole doesn't do this (in 2.11 it will).

For the user subclass, have you defined this class in a separate file?
It can't live in the same file as another package, because of a bug in
USC (again, that'll be fixed for 2.11).

What happens if you don't include Maypole::Application in the use
base? Just say 'use Maypole::Application' instead.

d.


-------------------------------------------------------
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