Change Catalsyt _parse_attrs so that when sub attr handlers:
[catagits/Catalyst-Runtime.git] / t / lib / TestApp / Controller / Attributes.pm
CommitLineData
683d672b 1use strict;
2use warnings;
3
4package My::AttributesBaseClass;
5use base qw( Catalyst::Controller );
6
0b0aee67 7sub fetch : Chained('/') PathPrefix CaptureArgs(0) { }
683d672b 8
0b0aee67 9sub left_alone :Chained('fetch') PathPart Args(0) { }
683d672b 10
0b0aee67 11sub view : PathPart Chained('fetch') Args(0) { }
683d672b 12
0b0aee67 13sub foo { } # no attributes
683d672b 14
0b0aee67 15package TestApp::Controller::Attributes;
16use base qw(My::AttributesBaseClass);
683d672b 17
0b0aee67 18sub _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 31sub view { } # override attributes to "hide" url
683d672b 32
0b0aee67 33sub foo : Local { }
683d672b 34
0b0aee67 35sub all_attrs_action :MakeMeVisible { }
683d672b 36
0b0aee67 37sub some_attrs_action :MakeMeVisible('some') PathPart('some_attrs') { }
683d672b 38
0b0aee67 39sub one_attr_action :MakeMeVisible('one') Chained('fetch') Args(0) { }
683d672b 40
411;