[Catalyst-commits] r7849 - /
trunk/Catalyst-Manual/lib/Catalyst/Manual
zarquon at dev.catalyst.perl.org
zarquon at dev.catalyst.perl.org
Thu May 29 00:44:23 BST 2008
Author: zarquon
Date: 2008-05-29 00:44:22 +0100 (Thu, 29 May 2008)
New Revision: 7849
Modified:
/
trunk/Catalyst-Manual/lib/Catalyst/Manual/Intro.pod
Log:
r13330 at zaphod: kd | 2008-05-29 09:11:09 +1000
expurgating deprecated default and index actions
Property changes on:
___________________________________________________________________
Name: svk:merge
- 1b129c88-ebf4-0310-add9-f09427935aba:/local/catalyst:4278
1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst:13296
3b9770f9-e80c-0410-a7de-cd203d167417:/local/catalyst:3514
dd8ad9ea-0304-0410-a433-df5f223e7bc0:/local/Catalyst:6909
+ 1b129c88-ebf4-0310-add9-f09427935aba:/local/catalyst:4278
1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst:13330
3b9770f9-e80c-0410-a7de-cd203d167417:/local/catalyst:3514
dd8ad9ea-0304-0410-a433-df5f223e7bc0:/local/Catalyst:6909
Modified: trunk/Catalyst-Manual/lib/Catalyst/Manual/Intro.pod
===================================================================
--- trunk/Catalyst-Manual/lib/Catalyst/Manual/Intro.pod 2008-05-28 14:10:18 UTC (rev 7848)
+++ trunk/Catalyst-Manual/lib/Catalyst/Manual/Intro.pod 2008-05-28 23:44:22 UTC (rev 7849)
@@ -104,6 +104,16 @@
Now http://localhost:3000/hello prints "Hello World!".
+Note that actions with the C< :Local > attribute are equivalent to
+using a C<:Path('/action_name') > attribute (note the leading slash).
+So our action could be equivalently:
+
+ sub hello : Path('/hello') {
+ my ( $self, $context ) = @_;
+ $context->response->body('Hello World!');
+ }
+
+
=item * B<Support for CGI, mod_perl, Apache::Request, FastCGI>
Use L<Catalyst::Engine::Apache> or L<Catalyst::Engine::CGI>. Other
@@ -337,9 +347,9 @@
script/myapp_create.pl model MyModel DBIC::Schema MySchema create=static 'dbi:SQLite:/tmp/myapp.db'
-L<DBIx::Class::Schema::Loader> automatically loads table layouts and
-relationships, and converts them into a static schema definition C<MySchema>,
-which you can edit later.
+L<DBIx::Class::Schema::Loader> can automaticall load table layouts and
+relationships, and convert them into a static schema definition
+C<MySchema>, which you can edit later.
Use the stash to pass data to your templates.
@@ -696,9 +706,10 @@
# Sets the actions in this controller to be registered with no prefix
# so they function identically to actions created in MyApp.pm
__PACKAGE__->config->{namespace} = '';
- sub default : Private {
+ sub default : Path {
my ( $self, $context ) = @_;
- $context->response->body('Catalyst rocks!');
+ $context->response->status(404);
+ $context->response->body('404 not found');
}
1;
@@ -797,6 +808,11 @@
explanation of the pre-defined meaning of Catalyst component class
names.
+Note that actions with the C< :Local > attribute are equivalent to the
+<:Path('action_name') > so sub foo : Local { } is equivalent to -
+
+ sub foo : Path('foo') { }
+
=item * B<Chained>
Catalyst also provides a method to build and dispatch chains of actions,
@@ -867,26 +883,21 @@
=over 4
-=item * B<default : Private>
+=item * B<default : Path>
Called when no other action matches. Could be used, for example, for
displaying a generic frontpage for the main app, or an error page for
individual controllers.
-If C<default> isn't acting how you would expect, look at using a
-L</Literal> C<Path> action (with an empty path string). The difference
-is that C<Path> takes arguments relative from the namespace and
-C<default> I<always> takes arguments relative from the root, regardless
-of what controller it's in. Indeed, this is now the recommended way of
-handling default situations; the C<default> private controller should
-be considered deprecated.
-=item * B<index : Private>
+=item * B<index : Path : Args (0) >
-C<index> is much like C<default> except that it takes no arguments
-and it is weighted slightly higher in the matching process. It is
-useful as a static entry point to a controller, e.g. to have a static
-welcome page. Note that it's also weighted higher than Path.
+C<index> is much like C<default> except that it takes no arguments and
+it is weighted slightly higher in the matching process. It is useful
+as a static entry point to a controller, e.g. to have a static welcome
+page. Note that it's also weighted higher than Path. Actually the sub
+name C<index> can be called anything you want. The sub attributes are
+what determines the behaviour of the action.
=item * B<begin : Private>
@@ -903,7 +914,7 @@
Package MyApp::Controller::Foo;
sub begin : Private { }
- sub default : Private { }
+ sub default : Path { }
sub auto : Private { }
You can define built-in private actions within your controllers as
More information about the Catalyst-commits
mailing list