On Wed, Dec 3, 2008 at 6:03 AM, Richard Jones <[EMAIL PROTECTED]>wrote:
> As in Catalyst action. Currently doing this:
>
> my $action = (split '/', $ENV{PATH_INFO})[1];
>
> So in a request http://localhost/myapp/admin/list_users, the action would
> be 'admin', so I can highlight the appropriate navigation link.
>
> But I'd assume there's a better way, something build-in to CGI::App?
>
The simplest idea is to just do this:
my $action = (split '/', $self->query->path_info)[1];
If you are doing path based dispatching have you looked at the Routes Plugin
( http://search.cpan.org/dist/CGI-Application-Plugin-Routes/ )
or the path_info option to mode_param (
http://search.cpan.org/dist/CGI-Application/lib/CGI/Application.pm#mode_param())?
These options can make your life easier by setting the runmode (action) from
the information in the path_info and then you
can get the name of the current action via $self->current_run_mode.
Clayton
--
Clayton Scott
[EMAIL PROTECTED]
##### CGI::Application community mailing list ################
## ##
## To unsubscribe, or change your message delivery options, ##
## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp ##
## ##
## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ##
## Wiki: http://cgiapp.erlbaum.net/ ##
## ##
################################################################