Add types::structured, as we need a calling convention.. Add namespace::autoclean...
[catagits/CatalystX-DynamicComponent.git] / lib / DynamicAppDemo / ControllerBase.pm
1 package DynamicAppDemo::ControllerBase;
2 use Moose;
3 use Moose::Util qw/find_meta/;
4 use namespace::clean -except => 'meta';
5
6 # You need attributes still for _DISPATCH and friends.
7 BEGIN { extends 'Catalyst::Controller' }
8
9 around get_action_methods => sub {
10     my $orig = shift;
11     my $self = shift;
12
13     my $meta = find_meta($self);
14     
15     # FIXME - fugly, and nasty
16     return (
17         (   map { 
18                 my $m = $meta->get_method($_);
19                 # EPIC CHEAT to just smash the attribute definition :)
20                 $m->meta->get_attribute('attributes')->set_value($m, ['Local']);
21                 $m;
22             }
23             grep { ! /^(_|new|meta)/ }
24             $meta->get_method_list
25         ),
26         (
27             $self->$orig(@_)
28         )
29     ); 
30 };
31
32 __PACKAGE__->meta->make_immutable;
33