Commit | Line | Data |
---|---|---|
683d672b | 1 | use strict; |
2 | use warnings; | |
3 | ||
4 | package My::AttributesBaseClass; | |
5 | use base qw( Catalyst::Controller ); | |
6 | ||
0b0aee67 | 7 | sub fetch : Chained('/') PathPrefix CaptureArgs(0) { } |
683d672b | 8 | |
0b0aee67 | 9 | sub left_alone :Chained('fetch') PathPart Args(0) { } |
683d672b | 10 | |
0b0aee67 | 11 | sub view : PathPart Chained('fetch') Args(0) { } |
683d672b | 12 | |
0b0aee67 | 13 | sub foo { } # no attributes |
683d672b | 14 | |
0b0aee67 | 15 | package TestApp::Controller::Attributes; |
16 | use base qw(My::AttributesBaseClass); | |
683d672b | 17 | |
0b0aee67 | 18 | sub _parse_MakeMeVisible_attr { |
19 | my ($self, $c, $name, $value) = @_; | |
20 | if (!$value){ | |
21 | return Chained => 'fetch', PathPart => 'all_attrs', Args => 0; | |
22 | } | |
23 | elsif ($value eq 'some'){ | |
24 | return Chained => 'fetch', Args => 0; | |
25 | } | |
26 | elsif ($value eq 'one'){ | |
27 | return PathPart => 'one_attr'; | |
28 | } | |
683d672b | 29 | } |
30 | ||
0b0aee67 | 31 | sub view { } # override attributes to "hide" url |
683d672b | 32 | |
0b0aee67 | 33 | sub foo : Local { } |
683d672b | 34 | |
0b0aee67 | 35 | sub all_attrs_action :MakeMeVisible { } |
683d672b | 36 | |
0b0aee67 | 37 | sub some_attrs_action :MakeMeVisible('some') PathPart('some_attrs') { } |
683d672b | 38 | |
0b0aee67 | 39 | sub one_attr_action :MakeMeVisible('one') Chained('fetch') Args(0) { } |
683d672b | 40 | |
41 | 1; |