With Catalyst you register your actions and address them directly. For
example:
- sub hello : Global {
+ sub hello : Local {
my ( $self, $context ) = @_;
$context->response->body('Hello World!');
}
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:
+using a C<:Path('action_name') > attribute, so our action could be
+equivalently:
- sub hello : Path('/hello') {
+ sub hi : Path('hello') {
my ( $self, $context ) = @_;
$context->response->body('Hello World!');
}
use strict;
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
+ use Catalyst qw/-Debug ConfigLoader Static::Simple/;
MyApp->config(
name => 'My Application',