CatalystX-ActionBuilders

 view release on metacpan or  search on metacpan

lib/CatalystX/ActionBuilders.pm  view on Meta::CPAN

74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
        navigation => [
            ':default',
            (map { "menu_$_" } qw{ label parent args cond order roles title }),
        ],
 
        action_role  => [ qw{ does }        ],
        simple_login => [ qw{ needs_login } ],
    },
};
 
sub index_parts() { (path_name(q{}), args(0)) }
sub action(&)     { return shift              }
 
# experimental - beore/after wrappers for our action method
sub before_action(&) { ( _before => $_[0] ) }
sub after_action(&)  { ( _after  => $_[0] ) }
 
#sub template($)    { my $t = shift; (_before => sub    { $_[1]->stash-> { template} = $t }) }
sub tweak_stash($$) { my ($k, $v) = @_; (_before => sub { $_[1]->stash-> { $k} = $v })       }
sub template($)     { tweak_stash(template => $_[0])                                         }
 
# standard atts
sub chained($)      { _att(Chained     => @_) }
sub args($)         { _att(Args        => @_) }
sub capture_args($) { _att(CaptureArgs => @_) }
sub path_part($)    { _att(PathPart    => @_) }
sub path_name($)    { _att(Path        => @_) }
sub action_class($) { _att(ActionClass => @_) }
 
# Catalyst::Plugin::Navigation specific bits
sub menu_label($)  { _att(Menu       => @_) }
sub menu_parent($) { _att(MenuParent => @_) }
sub menu_args($)   { _att(MenuArgs   => @_) }
sub menu_cond($)   { _att(MenuCond   => @_) }
sub menu_order($)  { _att(MenuOrder  => @_) }
sub menu_roles($)  { _att(MenuRoles  => @_) }
sub menu_title($)  { _att(MenuTitle  => @_) }
 
# Catalyst::Plugin::ActionRole
sub does($) { _att(Does => @_) }
 
# CatalystX::SimpleLogin
sub needs_login() { does 'NeedsLogin' }
 
sub _att { ( shift(@_) => [ @_ ] ) }
 
# XXX
my %counter = ();
 
sub _add_path {
    my ($path, $meta, $name, @args) = @_;
    my $sub = pop @args;



( run in 0.284 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )