X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial.pod;h=118950b858d4ccbc166cbad0bbc07d7577fa3dc8;hp=e26ae30efb0b6153c4ff26d17a4c8c55f18a9f46;hb=eff5f524553d82eb1672709248a6a2fdaaf0b089;hpb=15f0b5b7ea5d857766be67ecaebc9e5369d5f699 diff --git a/lib/Catalyst/Manual/Tutorial.pod b/lib/Catalyst/Manual/Tutorial.pod index e26ae30..118950b 100644 --- a/lib/Catalyst/Manual/Tutorial.pod +++ b/lib/Catalyst/Manual/Tutorial.pod @@ -209,13 +209,15 @@ for any component modules, locating and registering any actions it finds in those modules. Component modules have names prefixed with the application module name, -followed by C, C or C (or the default short -forms: C, C or C) followed by the component name, for example: +followed by C, C or C (or the optional long +forms: C, C or C) followed by the component +name, for example: + My::App::C::ShoppingCart # short (default) version My::App::Controller::ShoppingCart # long version - My::App::C::ShoppingCart # short version - + My::App::M::User # short (default) version + My::App::Model::User # long version =head2 Extending the generated code @@ -231,11 +233,22 @@ You can start extending the application by adding new actions: $c->res->output('Congratulations, My::App is on Catalyst!'); } + # called like '/article/2005/06' + sub archive_month : Regex('^article/(\d{4})/(\d{2})$') { + my ( $self, $c ) = @_; + + my $datetime = DateTime->new( + year => $c->request->snippets->[0], + month => $c->request->snippets->[1] + ); + } TODO: explain briefly about plugins, actions, and components -regex actions passed subexpression matches in $c->req->snippets -(array ref). +If the action is a Regex type, you can use capturing parentheses to +extract values within the matching URL (2005, 06 in the above +example). Those values are available in the $c->req->snippets +anonymous array. See L for details. =head2 Hooking in to Template Toolkit