CatalystX-ActionBuilders
view release on metacpan or search on metacpan
lib/CatalystX/ActionBuilders.pm view on Meta::CPAN
# 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
lib/CatalystX/ActionBuilders.pm view on Meta::CPAN
# XXX squash them down before adding to config
#my $action_attributes = { @$path, @args };
my $action_attributes = Hash::MultiValue->new(@$path, @args);
my @before = $action_attributes->get_all('_before');
delete $action_attributes->{'_before'};
my @after = $action_attributes->get_all('_after');
delete $action_attributes->{'_after'};
# some menu defaults
if (exists $action_attributes->{Menu}) {
$action_attributes->{MenuOrder} = $counter{$meta->name} += 10
unless exists $action_attributes->{MenuOrder};
}
# so there's two ways (I know of) to proceed here... The first (and the
# one we use) is to poke at our class' config() and establish our actions
# here. The second would be to fiddle with the method's metaclass to add
# attributes to it. Both allow the standard action discovery to work, but
# the config method seems a little less magical, so that's what we're
# using right now.
#
# ...and by "less magical" I mean "without the additional metaclass
( run in 1.713 second using v1.01-cache-2.11-cpan-49f99fa48dc )