use Catalyst qw[-Engine=Test];
-__PACKAGE__->action(
- foo => sub {
- my ( $self, $c ) = @_;
- $c->res->output('bar');
- }
-);
+sub foo : Global {
+ my ( $self, $c ) = @_;
+ $c->res->output('bar');
+}
+
+__PACKAGE__->setup;
package main;
use Catalyst qw[-Engine=Test];
-__PACKAGE__->action(
- '/foo/(.*)/' => sub {
+sub testregex : Regex(foo/(.*)) {
my ( $self, $c ) = @_;
$c->res->output( $c->req->snippets->[0] );
- }
-);
+}
+
+__PACKAGE__->setup();
package main;
use Catalyst qw[-Engine=Test];
-__PACKAGE__->action(
- foo => sub {
- my ( $self, $c ) = @_;
- $c->res->output( $c->req->params->{foo} );
- }
-);
+sub foo : Global {
+ my ( $self, $c ) = @_;
+ $c->res->output( $c->req->params->{foo} );
+}
+
+__PACKAGE__->setup;
package main;
use Catalyst qw[-Engine=Test];
-__PACKAGE__->action(
- foo => sub {
- my ( $self, $c, $arg ) = @_;
- $c->res->output($arg);
- }
-);
+sub foo : Global {
+ my ( $self, $c, $arg ) = @_;
+ $c->res->output($arg);
+}
+
+__PACKAGE__->setup;
package main;
use Catalyst qw[-Engine=Test];
-__PACKAGE__->action(
- foo => sub {
- my ( $self, $c ) = @_;
- $c->res->headers->header( 'X-Foo' => 'Bar' );
- }
-);
+sub foo : Global {
+ my ( $self, $c ) = @_;
+ $c->res->headers->header( 'X-Foo' => 'Bar' );
+}
+
+__PACKAGE__->setup;
package main;
use Catalyst qw[-Engine=Test];
-__PACKAGE__->action(
- foo => sub {
- my ( $self, $c ) = @_;
- $c->res->cookies->{foo} = { value => 'bar' };
- }
-);
+sub foo : Global {
+ my ( $self, $c ) = @_;
+ $c->res->cookies->{foo} = { value => 'bar' };
+}
+
+__PACKAGE__->setup;
package main;
use Catalyst qw[-Engine=Test];
-__PACKAGE__->action(
- foo => sub {
- my ( $self, $c ) = @_;
- $c->forward('bar');
- },
- bar => sub {
- my ( $self, $c, $arg ) = @_;
- $c->res->output($arg);
- }
-);
+sub foo : Global {
+ my ( $self, $c ) = @_;
+ $c->forward('bar');
+}
+sub bar : Global {
+ my ( $self, $c, $arg ) = @_;
+ $c->res->output($arg);
+}
+
+__PACKAGE__->setup;
package main;