[Catalyst] Listing all actions in app
David Schmidt
davewood at gmx.at
Thu Feb 16 19:19:44 GMT 2012
If you start your app in debug mode you get a list of all actions.
or ...
# catalyst.pl Foo
# cd Foo
# vim list_actions.pl
1 #!/usr/bin/env perl
2 use strict;
3 use warnings;
4 use v5.10.1;
5 use FindBin qw/$Bin/;
6 use lib "$Bin/lib";
7 use Data::Dumper;
8 use Foo;
9
10 my $app = Foo->new();
11
12 my @controllers = map { $app->controller($_) } $app->controllers;
13 for my $controller (@controllers) {
14 my @actions = $controller->get_action_methods;
15 say $_->name . ': ' . join(',', @{$_->attributes}) for @actions;
16 }
david at kvm6:~/Foo$ perl list_actions.pl
_DISPATCH: Private
_BEGIN: Private
_AUTO: Private
_ACTION: Private
_END: Private
index: Path,Args(0)
default: Path
end: ActionClass('RenderView')
On 16 February 2012 18:34, Paolo Gianrossi <paolino.gianrossi at gmail.com> wrote:
> Hi List!
>
> I have an app and I would like to be able to list (in a <select>, but
> whatever), all public actions in all controllers of my app.
>
> Is there an easy way to do this?
>
> Thanks a lot!
>
> cheers
> paolino
>
> --
> Paolo Gianrossi
>
> (An unmatched left parenthesis
> creates an unresolved tension
> that will stay with you all day
> -- xkcd
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
More information about the Catalyst
mailing list