[Catalyst] RFC on how to structure controllers

Zbigniew Lukasiak zzbbyy at gmail.com
Thu Jun 15 16:22:22 CEST 2006


Hi,

The ChildOf mechanism looks promising.  But after reading the docs I
still don't know how to make a multilingual or branded site (without
too much hassle).  I'll present here my guesses - please correct me if
I don't understand the docs.

So I can build the language consumer:

sub lang_handler :PathPart('lang') :ChildOf('/') :Captures(1) {
 	      my ( $self, $c ) = @_;
	      $c->stash->{'lang'} =   $c->req->captures->[0];
}

But it than seems that then for every other action I would have to add
the :PathPart and :ChildOf('/lang') attributes (to declare that they
are childred on the 'lang').  This seems a bit excessive.

--
Zbyszek


On 6/13/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
> Gert Burger wrote:
> > 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.
>
> Have a look at the :ChildOf attribute in
>
> http://dev.catalyst.perl.org/browser/branches/Catalyst-ChildOf/lib/Catalyst/Manual/Intro.pod
>
> for a cleaner, non-regex way to implement this sort of URL that I've been
> working on.
>
> This should hopefully go back to trunk before 5.70 ships.
>
> --
>       Matt S Trout       Offering custom development, consultancy and support
>    Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
> Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information
>
> + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +
>
> _______________________________________________
> 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/
>


-- 
Zbigniew Lukasiak
http://brudnopis.blogspot.com/



More information about the Catalyst mailing list