Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Catalyst and the stash

by astroboy (Chaplain)
on Jul 19, 2005 at 19:55 UTC ( #476252=note: print w/replies, xml ) Need Help??


in reply to Catalyst and the stash

This doen't seem any different from the param method in CGI::Application - sometimes you need to have data globally accessible to your code. It does act like a global, but so do session variables ... they suffer the same risks as well, but they sure are useful. If you're worried about naming collissions, you could include your namespace in your stash:
$c->stash->{MyAppFoo} = 'store some stuff';

Replies are listed 'Best First'.
Re^2: Catalyst and the stash
by samtregar (Abbot) on Jul 19, 2005 at 20:25 UTC
    It's pretty rare to send your entire CGI::App param() hash to a template though!

    CGI::App's param() is meant to allow instance scripts to configure the application via the PARAM option to new(). Using it to hold global data generated inside the app isn't a very good idea in my opinion.

    -sam

      CGI::App's param() is meant to allow instance scripts to configure the application via the PARAM option to new().

      True, but I don't think that it's the only reason for param(). Param was recently a hot topic on the CGI::App mail list. It's also the preferred way for creating your own variables in your subclass of CGI::App without adding to the internal blessed hash directly. As such, you don't always want to do this in new(). It seems to me that the Catalyst stash is performing the same task.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://476252]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2023-09-27 04:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?