Hi All,<br><br>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.<br>controllers will register URLs at catalyst startup.<br><br>
I have to store this data into variable (not in any file or database) which will be accessible in all the controllers.<br>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.
<br><br>hope you guys can understand my requirement.<br><br>Thanks,<br>Aditya<br><br><div><span class="gmail_quote">On 8/21/07, <b class="gmail_sendername">John Napiorkowski</b> <<a href="mailto:jjn1056@yahoo.com">jjn1056@yahoo.com
</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>--- Aditya Verma <<a href="mailto:verma.aditya1@gmail.com">verma.aditya1@gmail.com
</a>> wrote:<br><br>> Hi,<br>><br>> I am running catalyst under apache configured with<br>> mod_perl.<br>><br>> Can I somehow access stash out methods.<br>><br>> I want to declare a global variable inside
<br>> controller and outside methods<br>> which will be accessible in all controllers.<br>> stash could be a solution but outside methods<br>> context object is not<br>> available so i don't have access to stash.
<br>><br>> please help me solve the problem.<br>><br>> Thanks,<br>> Aditya<br><br>Hi,<br><br>I may not fully understand your use case, but<br>typically the stash is used for a particular context,<br>not as a global thing.
<br><br>You can alway pass the context to methods that need<br>it. I know it seems cumbersome, but the reason is to<br>make you really think if you need it, the idea being<br>that you should try to decouple your context as much
<br>as possible.<br><br>If you need some global information there are a few<br>ways I can think of:<br><br>1) put it into the configuration file. This is great<br>for static stuff, like admin email address, etc.<br>2) Create a model that provides the information you
<br>need. If this information is based on the current<br>context you can inherit from<br>"Catalyst::Component::ACCEPT_CONTEXT" to build it.<br>3) Create a base controller with a method that gets<br>the information you need. The have the controllers
<br>that need this information inherit from that.<br><br>You might get the suggestion to make this a catalyst<br>plugin, but that's no longer recommended best<br>practices. Plugins should be reserved for when you<br>
are trulying enhancing/extending the basic Catalyst<br>features.<br><br>Please share with us the details of the use case and<br>maybe we can help.<br><br>--John<br><br><br><br>____________________________________________________________________________________
<br>Choose the right car based on your needs. Check out Yahoo! Autos new Car Finder tool.<br><a href="http://autos.yahoo.com/carfinder/">http://autos.yahoo.com/carfinder/</a><br><br>_______________________________________________
<br>List: <a href="mailto:Catalyst@lists.rawmode.org">Catalyst@lists.rawmode.org</a><br>Listinfo: <a href="http://lists.rawmode.org/mailman/listinfo/catalyst">http://lists.rawmode.org/mailman/listinfo/catalyst</a><br>Searchable archive:
<a href="http://www.mail-archive.com/catalyst@lists.rawmode.org/">http://www.mail-archive.com/catalyst@lists.rawmode.org/</a><br>Dev site: <a href="http://dev.catalyst.perl.org/">http://dev.catalyst.perl.org/</a><br></blockquote>
</div><br>