On 26 Sep 2005, at 19:30, David Baird wrote:

On 9/26/05, Kieren Diment <[EMAIL PROTECTED]> wrote:

Quick question about authentication.

I have things set up so that users have to log in to be able to
access the site.

However, I'd like users who are not logged in to be automatically
logged in as a user with the fullname "guest" (which happens to be id
no 3, but that's not very human readable).

I've tried this:

$r->user = $r->objects([CokeWorks::User->retrieve (fullname =>
"guest")]) unless $r->user;

but it fails with the error:  "caught authenticate error: Can't
modify non-lvalue subroutine call "...

How can I modify $r so that there's an automatically assigned user
class?



'user' is a Class::Accessor accessor, which Maypole uses for a lot of
things. Use it like this:

# get
my $user = $r->user;

#set

$r->user( $new_user );

The non-lvalue error means you're trying to assign a value to
something that cannot be assigned to.


Thanks. Works a treat. Very obvious, but not clearly documented. I think this offers a clue as to how the documentation should evolve. Actually, I it needs to be refactored. How's this for a putative structure:

Maypole::Manual (intro)
Maypole::Manual::Example::Simple (BeerDB)
Maypole::Manual::Example::LessSimple (maybe Simon's latest example,updated, or something else)
Maypole::Manual::Application::Data (data storage)
Display (data display) Structure (best practice in terms of subclassing out the app for maintainable structure) Cookbook (including stuff like the OP)...

So a more modular documentation to ease maintainability.

I think the problem is that Simon Cozens is clearly a very talented perl programmer, and a competent technical writer. I think, documenting his own work, it tends to reflect the contents of his own mind rather more than it should, i.e. too much assumed knowledge about problems where the solution is not obvious.

Comments?


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

Reply via email to