role { my $param = shift; my $NAME = $param->name; my $ROOT = $param->root; my $MODEL = $param->model_name; my $PATH_PART = $param->path_part; method model => sub { $_[1]->model( $MODEL ) }; method root => sub { ... }; method list => sub {...}; # The purpose of this 'before' is to add keys # into config hash first (only first) time the config is touched. my $config_called; before config => sub { return if $config_called++; my $action_config = shift()->config->{action} ||= {}; %$action_config = ( %$action_config, root => { Chained => [$ROOT], PathPart => [$PATH_PART], CaptureArgs => [0], }, list => { Chained => ['root'], PathPart => [''], Args => [0], } ); }; };