patch to make prepare_parameters not be both a builder and a preparer
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / Controller / ContextClosure.pm
CommitLineData
d9d8aa51 1package TestApp::Controller::ContextClosure;
2
3use Moose;
4
5BEGIN {
6 extends 'Catalyst::Controller';
7 with 'Catalyst::Component::ContextClosure';
8}
9
10sub normal_closure : Local {
11 my ($self, $ctx) = @_;
12 $ctx->stash(closure => sub {
13 $ctx->response->body('from normal closure');
14 });
15 $ctx->response->body('stashed normal closure');
16}
17
18sub context_closure : Local {
19 my ($self, $ctx) = @_;
20 $ctx->stash(closure => $self->make_context_closure(sub {
111878af 21 my ($ctx) = @_;
d9d8aa51 22 $ctx->response->body('from context closure');
23 }, $ctx));
24 $ctx->response->body('stashed context closure');
25}
26
27__PACKAGE__->meta->make_immutable;
28
291;