[Catalyst] access stash outside methods

Matt Rosin telebody at gmail.com
Tue Aug 21 18:28:30 GMT 2007


Your use of terms is a little confusing, can you explain better what
you want to do? What do you mean by "outside methods context object"?

You don't really want to declare a perl global variable since this
could hurt your persistent server. Perhaps you want (Model) class data
or you want to put some data in $c->config with myapp.yml as John
suggests.

You mentioned a context object, this can have different meanings. You
can persist data through Catalyst::Plugin::Session (add to session or
use $c->flash) which could simulate a persistent context within a user
session (like a persisted stash).  Or perhaps store state information
in a user object in the database which might be more robust since it
doesn't depend on session files or cookies.



More information about the Catalyst mailing list