[Catalyst] RFC on how to structure controllers
Marcello Romani
mromani at ottotecnica.com
Tue Jun 13 13:41:54 CEST 2006
Gert Burger ha scritto:
> Hi
>
> I would like some ideas on how todo the following in cat.
>
> I am in the process of designing a webapp that will allow online
> gamers(Specificly players in ZA) to interact for a select few games.
> Ie. There will be sections which will be common to each game, just
> slightly customized for the game.
>
> My problem is, how do I make sure my controllers know which game they
> are currently working on, some of my ideas included:
> -Using cookies to store the currently selected game.
> -Using get/post params to send it each time a request is made.
> -Using the game as part of the url, eg
> http://bla/games/ageofempires3/gamebooking, this will complicate the
> controller's methods a bit as each method will be a regex.
> -Or(not) creating a child controller for each game that inherits from a
> base game controller.
>
> Any ideas?
>
> Gert Burger
>
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
>
>
Why not store the selected game inside the user's session instead of the
cookie ?
This way the controller whould know which game it's operating on by
looking at something like $c->session->{game}
Using session data you also allow the gamer to logout at some time (even
automatically, via some sort of timeout), then re-authenticate without
loosing the information on what game he selected previously.
Just a pair of thoughts...
HTH
--
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.com
More information about the Catalyst
mailing list