Catalyst-Runtime

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

          parse_on_demand is on

5.80003 2009-04-29 16:23:53
        - Various POD tweaks. (hdp, dandv)
        - Fix formatting error in the regex fallback warning.
        - Convert the dispatcher's and restarter engine's BUILD method to
          attribute builders to not override the BUILD method from
          MooseX::Emulate::Class::Accessor::Fast.
        - Fix classes without metaclasses restarting, when not using
          B::Hooks::OP::Check::StashChange
        - Fix the unattached chain debug table for endpoints with no
          parents at all.
        - Turn off test aggregation by default. Only aggregate if the
          AGGREGATE_TESTS environment variable is set and a recent
          Test::Aggregate is available.
        - Bump to MooseX::MethodAttributes 0.09, to gain the
          get_nearest_methods_with_attributes method allowing methods without
          attributes in a subclass to override those with attributes in a
          superclass. This fixes CatalystX::CRUD's method of overriding /
          disabling functionality from base controllers.
        - Bump HTTP::Request::AsCGI dependency to avoid broken version

lib/Catalyst/Controller.pm  view on Meta::CPAN

specifically (for a single action).

    __PACKAGE__->config(
        action => {
            '*' => { Chained => 'base', Args => 0  },
            base => { Chained => '/', PathPart => '', CaptureArgs => 0 },
        },
     );

In the case above every sub in the package would be made into a Chain
endpoint with a URI the same as the sub name for each sub, chained
to the sub named C<base>. Ergo dispatch to C</example> would call the
C<base> method, then the C<example> method.

=head2 action_args

Allows you to set constructor arguments on your actions. You can set arguments
globally and specifically (as above).
This is particularly useful when using C<ActionRole>s
(L<Catalyst::Controller::ActionRole>) and custom C<ActionClass>es.

t/aggregate/live_component_controller_action_go.t  view on Meta::CPAN

          TestApp::Controller::Action::Go->begin
          TestApp::Controller::Action::Go->go_chained
          TestApp::Controller::Action::Chained->begin
          TestApp::Controller::Action::Chained->foo
          TestApp::Controller::Action::Chained::Foo->spoon
          TestApp::Controller::Action::Chained->end
        ];

        my $expected = join( ", ", @expected );

        ok( my $response = request('http://localhost/action/go/go_chained'), 'go to chained + subcontroller endpoint' );
        is( $response->header('X-Catalyst-Executed'),
            $expected, 'Executed actions' );
        is( $response->content, 'captureme; arg1, arg2', 'Content OK' );
    }

}



sub _begin {

t/aggregate/live_component_controller_action_visit.t  view on Meta::CPAN

          TestApp::Controller::Action::Chained->foo
          TestApp::Controller::Action::Chained::Foo->spoon
          TestApp::Controller::Action::Chained->end
          TestApp::Controller::Root->end
        ];

        my $expected = join( ", ", @expected );

        for my $i ( 1..3 ) {
            ok( my $response = request("http://localhost/action/visit/visit_chained/$i/becomescapture/arg1/arg2"),
                "visit to chained + subcontroller endpoint for $i" );
            is( $response->header('X-Catalyst-Executed'),
                $expected, "Executed actions for $i" );
            is( $response->content, "becomescapture; arg1, arg2",
                "Content OK for $i" );
        }
    }

}


t/aggregate/unit_core_uri_for_action.t  view on Meta::CPAN

   "no URI returned for index action when snippets are given");

is($dispatcher->uri_for_action($index_action),
   "/action/index",
   "index action returns correct path");

#
#   Chained Action
#
my $chained_action = $dispatcher->get_action_by_path(
                       '/action/chained/endpoint',
                     );

ok(!defined($dispatcher->uri_for_action($chained_action)),
   "Chained action without captures returns undef");

ok(!defined($dispatcher->uri_for_action($chained_action, [ 1, 2 ])),
   "Chained action with too many captures returns undef");

is($dispatcher->uri_for_action($chained_action, [ 1 ]),
   "/chained/foo/1/end",

t/bad_warnings.t  view on Meta::CPAN

    $c->response->body("This is the body");
    Test::More::is $c->action->comparable_arg_number, ~0;
  }

  sub midpoint :Chained(root) PathPart('') CaptureArgs('"Int"') {
    my ($self, $c) = @_;
    Test::More::is $c->action->number_of_captures, 1;
    #Test::More::is $c->action->number_of_captures_constraints, 1;
  }

  sub endpoint :Chained('midpoint') Args('"Int"') {
    my ($self, $c) = @_;
    Test::More::is $c->action->comparable_arg_number, 1;
    Test::More::is $c->action->normalized_arg_number, 1;
  }

  sub local :Local Args {
    my ($self, $c) = @_;
    $c->response->body("This is the body");
    Test::More::is $c->action->comparable_arg_number, ~0;
  }

t/lib/TestAppIndexDefault/Controller/IndexChained.pm  view on Meta::CPAN

package TestAppIndexDefault::Controller::IndexChained;

use base 'Catalyst::Controller';

sub index : Chained('/') PathPart('indexchained') CaptureArgs(0) {}

sub index_endpoint : Chained('index') PathPart('') Args(0) {
    my ($self, $c) = @_;
    $c->res->body('index_chained');
}

1;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.317 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )