[Catalyst-commits] r8833 - trunk/examples/CatalystAdvent/root/2008/pen

zarquon at dev.catalyst.perl.org zarquon at dev.catalyst.perl.org
Fri Dec 12 00:03:35 GMT 2008


Author: zarquon
Date: 2008-12-12 00:03:35 +0000 (Fri, 12 Dec 2008)
New Revision: 8833

Modified:
   trunk/examples/CatalystAdvent/root/2008/pen/11.pod
Log:
edits

Modified: trunk/examples/CatalystAdvent/root/2008/pen/11.pod
===================================================================
--- trunk/examples/CatalystAdvent/root/2008/pen/11.pod	2008-12-11 23:58:37 UTC (rev 8832)
+++ trunk/examples/CatalystAdvent/root/2008/pen/11.pod	2008-12-12 00:03:35 UTC (rev 8833)
@@ -1,23 +1,26 @@
 =head1 Doing rails-style routes with Catalyst
 
-People often ask about using rails-style routes, and why Catalyst doesn't
-"support" them. Well, actually, it does - through the magic of config.
+People often ask about using rails-style routes, and why Catalyst
+doesn't "support" them. Well, actually, it does - through the magic of
+config.
 
 =head1 Routes via the config file
 
-The key is this: action attributes are actually just defaults - when you do
+The key is this: action attributes are actually just defaults - when
+you do
 
   sub foo :Local {
 
-that makes the default attribute hash for foo { Local => [ '' ] }. Well,
-it doesn't, because Local is parsed - what you actually get for
+that makes the default attribute hash for foo C< { Local => [ '' ]
+} >. Well, it doesn't, because Local is parsed - what you actually get
+for
 
   package MyApp::Controller::Name;
 
   sub foo :Local {
 
-is { Path => [ 'name/foo' ] }. Now, this can be overriden from the config
-file by doing something like:
+is C< {  Path => [ 'name/foo' ]  } >. Now, this can  be overriden from
+the config file by doing something like:
 
   <Controller Name>
     <action foo>
@@ -42,10 +45,11 @@
     }
   );
 
-alhtough this is still quite verbose, of course. Generally, this approach is
-only ever used to allow URL localisations - for example if you sell a white
-label app to a foreign client you can change the URL parts to their language;
-I'm aware of people having done this in production.
+although this is still quite verbose, of course. Generally, this
+approach is only ever used to allow URL localisations - for example if
+you sell a white label app to a foreign client you can change the URL
+parts to their language; I'm aware of people having done this in
+production.
 
 Of course, the other thing you can do is to use this to make reusable
 controllers -
@@ -82,10 +86,11 @@
 
 =head1 Syntactic sugar
 
-But we were talking about routes, weren't we? Though I would observe that
-controllers' self-contained-ness is what makes this sort of subclass-to-reuse
-stuff possible; the rails guys say "re-use in the large is overrated", we
-say "well, actually, it's bloody hard, but if you're careful ...". Anyway.
+But we were talking about routes, weren't we? Though I would observe
+that controllers' self-contained-ness is what makes this sort of
+subclass-to-reuse stuff possible; the rails guys say "re-use in the
+large is overrated", we say "well, actually, it's bloody hard, but if
+you're careful ...". Anyway.
 
 Let's see if we can't make routes a bit prettier.
 
@@ -115,11 +120,9 @@
   };
 
 and the end result will be (provided we've marked foo as an action via
+C< sub foo :Action { > ) that /some/path will dispatch to that method
+on MyApp::Controller::Name.
 
-  sub foo :Action {
-
-) that /some/path will dispatch to that method on MyApp::Controller::Name.
-
 Of course, I still think that Catalyst's self-contained controller approach
 is better, but if you really want routes, please consider the code above as
 under the same license as perl and send CatalystX::Routes to the CPAN :)




More information about the Catalyst-commits mailing list