Aditya Verma wrote: > Hi All, > > I want all of my controllers to register there respective URLs with > description. this data will be used in template to create dynamic HTML > pages. > controllers will register URLs at catalyst startup. > > I have to store this data into variable (not in any file or database) > which will be accessible in all the controllers. > To get the registration work I have to write statement outside of all > controller methods to execute the same at the time of catalyst startup.
How about using attributes?
pacakge MyApp::Controller::Anything;
use base 'MyApp::Controler::HasDescription';
sub some_action
:Path :Args(1) :URL('/some_action/*') :Description('Some
action!') {
# your action
}
# etc.
Those get parsed at startup time, and you can probably shove them in
$app->config or somewhere similarly convenient. You can also just walk
all actions and look for the URL and Description attributes. This is
pretty easy to do, but I don't know the details so I will let you glean
them from the code/docs. $c->action_for('/some_action')->attributes
should be close. Have fun.
Regards,
Jonathan Rockway
signature.asc
Description: OpenPGP digital signature
_______________________________________________ List: [email protected] Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
