Commit | Line | Data |
2167982f |
1 | package TestApp::Controller::Moose; |
2 | |
3 | use Moose; |
4 | |
5 | use namespace::clean -except => 'meta'; |
6 | |
7 | BEGIN { extends qw/Catalyst::Controller/; } |
cf37d21a |
8 | use MooseX::MethodAttributes; # FIXME - You need to say this if you have |
9 | # modifiers so that you get the correct |
10 | # method metaclass, why does the modifier |
11 | # on MODIFY_CODE_ATTRIBUTES not work. |
2167982f |
12 | |
13 | has attribute => ( |
14 | is => 'ro', |
15 | default => 42, |
16 | ); |
17 | |
18 | sub get_attribute : Local { |
19 | my ($self, $c) = @_; |
20 | $c->response->body($self->attribute); |
21 | } |
22 | |
84848664 |
23 | sub with_local_modifier : Local { |
24 | my ($self, $c) = @_; |
25 | $c->forward('get_attribute'); |
26 | } |
27 | |
28 | before with_local_modifier => sub { |
cf37d21a |
29 | my ($self, $c) = @_; |
30 | $c->response->header( 'X-Catalyst-Test-Before' => 'before called' ); |
31 | }; |
32 | |
2167982f |
33 | 1; |