stop using Moo as a test package
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / Controller / ContextClosure.pm
1 package TestApp::Controller::ContextClosure;
2
3 use Moose;
4
5 BEGIN {
6     extends 'Catalyst::Controller';
7     with 'Catalyst::Component::ContextClosure';
8 }
9
10 sub 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
18 sub context_closure : Local {
19     my ($self, $ctx) = @_;
20     $ctx->stash(closure => $self->make_context_closure(sub {
21         my ($ctx) = @_;
22         $ctx->response->body('from context closure');
23     }, $ctx));
24     $ctx->response->body('stashed context closure');
25 }
26
27 sub non_closure : Local {
28     my ($self, $ctx) = @_;
29     $ctx->stash(no_closure => "not a closure");
30 }
31
32 __PACKAGE__->meta->make_immutable;
33
34 1;