[Catalyst] How to get the name of the subroutine accessed?

Octavian Râşniţă orasnita at gmail.com
Tue Dec 8 19:19:48 GMT 2009


Hi,

Is there a similar method for $c->action that can be used for getting the 
name of the subroutine which is accessed?

For example, if I have:

sub main_action : Local {
  my ($self, $c) = @_;
  # Here I can use $c->action to get the name/of/the/main_action.

  # But if I do:
  $c->forward('another_subroutine');
}

sub another_subroutine {
  my ($self, $c) = @_;
  #Here I can't use $c->action for getting the 
name/of/the/another_subroutine
  # because it would return the name/of/the/main_action.
}

I want to use that unique name of the private subroutine, because I want to 
include it in a hash which will be used as a cache key and it would be nice 
if if there would be a possibility to not need writing it manually.

Thanks.

Octavian




More information about the Catalyst mailing list