File: Attributes.pm

package info (click to toggle)
libcatalyst-perl 5.90132-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,016 kB
  • sloc: perl: 11,061; makefile: 7
file content (41 lines) | stat: -rw-r--r-- 957 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
use strict;
use warnings;

package My::AttributesBaseClass;
use base qw( Catalyst::Controller );

sub fetch : Chained('/') PathPrefix CaptureArgs(0) { }

sub left_alone :Chained('fetch') PathPart Args(0) { }

sub view : PathPart Chained('fetch') Args(0) { }

sub foo { } # no attributes

package TestApp::Controller::Attributes;
use base qw(My::AttributesBaseClass);

sub _parse_MakeMeVisible_attr {
    my ($self, $c, $name, $value) = @_;
    if (!$value){
        return Chained => 'fetch', PathPart => 'all_attrs', Args => 0;
    }
    elsif ($value eq 'some'){
        return Chained => 'fetch', Args => 0;
    }
    elsif ($value eq 'one'){
        return PathPart => 'one_attr';
    }
}

sub view { }    # override attributes to "hide" url

sub foo : Local { }

sub all_attrs_action :MakeMeVisible { }

sub some_attrs_action :MakeMeVisible('some') PathPart('some_attrs') { }

sub one_attr_action :MakeMeVisible('one') Chained('fetch') Args(0) { }

1;