[Catalyst-dev] Moose + Catalyst port

Guillermo Roditi groditi at gmail.com
Sat Mar 15 22:12:03 GMT 2008


>  What I'd really like is a way to add _one_ method via a plugin, while
>  keeping most of the logic outside the plugged-into class.
>
>  For example, I like to add a "$c->user()" (or it could be
>  "$c->request()->user()") method. I don't need to add the
>  "_determine_user_from_cookie()" method I'm using under the hood, though.

Hmmmm, I like this, but I suspect the way to do it would be to:

add attribute: user that isa UserClass|Undef with a default sub which
takes care of building the value (or not). The default CodeRef could
then call class methods on the user class with the appropriate
Catalyst data to to do it's thing and return a built object or undef
if there is no user.

Or we could extend the accessor to, in the case there is no user
object yet, make it see if the appropriate data is there to build the
user object and if it's not just return.


Anyways... details like this are way too specific for this stage of the game.


-- 
Guillermo Roditi (groditi)



More information about the Catalyst-dev mailing list