1 package DynamicAppDemo::ControllerBase;
3 use Moose::Util qw/find_meta/;
4 use namespace::autoclean;
6 # You need attributes still for _DISPATCH and friends.
7 BEGIN { extends 'Catalyst::Controller' }
9 sub get_reflected_action_methods {
11 my $meta = find_meta($self);
13 return map { $self->_smash_method_attributes($_) }
14 grep { ! /^(_|new|meta)/ }
15 $meta->get_method_list;
18 # EPIC CHEAT to just smash the attribute definition :)
19 sub _smash_method_attributes {
20 my ($self, $name) = @_;
21 my $meta = find_meta($self);
23 my $m = $meta->get_method($name);
24 $m->meta->get_attribute('attributes')->set_value($m, ['Local']);
28 around get_action_methods => sub {
32 return ($self->get_reflected_action_methods, $self->$orig(@_));
35 __PACKAGE__->meta->make_immutable;