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
=head3 Install
-Installation of Catalyst can be a time-consuming and frustrating
-effort, due to its large number of dependencies. The easiest way
-to get up and running is to use Matt Trout's C<cat-install>
-script, from L<http://www.shadowcatsystems.co.uk/static/cat-install>,
-and then install L<Catalyst::Devel>.
+Installation of Catalyst can be a time-consuming effort, due to its
+large number of dependencies. Although most of the frustrations
+associated with this are now ironed out and a simple C<cpan
+Catalyst::Devel> or C<cpan Catalyst::Runtime> are now usually
+straightforward, if you still have problems, you can use use Matt
+Trout's C<cat-install> script, from
+L<http://www.shadowcatsystems.co.uk/static/cat-install>, and then
+install L<Catalyst::Devel>.
# perl cat-install
# perl -MCPAN -e 'install Catalyst::Devel'
$ cd MyApp
$ script/myapp_create.pl controller Library::Login
+=head4 Frank Speiser's Amazon EC2 Catalyst SDK
+
+There are currently two flavors of publicly available Amazon Machine
+Images (AMI) that include all the elements you'd need to begin
+developing in a fully functional Catalyst environment within
+minutes. See
+L<Catalyst::Manual::Installation|Catalyst::Manual::Installation> for
+more details.
+
+
=head3 Run
$ script/myapp_server.pl
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.
package MyApp;
use strict;
- use Catalyst qw/-Debug/; # Add other plugins here, e.g.
- # for session support
-
+ use parent qw/Catalyst/;
+ __PACKAGE__->setup(qw/-Debug ConfigLoader Static::Simple/);
+ # note you can still use use Catalyst qw/@plugins/ instead of the
+ # above two lines
MyApp->config(
name => 'My Application',
# 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;
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,
=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.
+individual controllers. B<Note>: in older Catalyst applications you
+will see C<default : Private> which is roughly speaking equivalent.
-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. B<Note>: in older
+Catalyst applications, you will see C<index : Private> used, which is
+roughly speaking equivalent.
=item * B<begin : Private>
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