Hi, On Thu, Mar 28, 2013 at 10:49 AM, Jerker Montelius <jerker.montel...@gmail.com> wrote: > OK. What I dont get is how to make variables global, session, and local. > Please describe how I store a global $dbh handler or a session login token?
By local variables I'm assuming you mean in the component context? If so: <%class> has 'variable'; </%class> You can access it from the component as $self->variable or $.variable if you have the DollarDot plugin active. Mason doesn't have any session logic at all. You enable sessions with a Plack middleware, usually Plack::Middleware::Session. To access the session hash, you can use $m->req->session. Poet adds the $m->session shortcut, but uses the same Plack middleware for actual session implementation. As for global variables, Jérôme already told you about allow_globals and set_global. Myself I avoid it and hide the global variable behind a method call: my $dbh = My::Project::DB->get_dbh; This way, you can do whatever you need to to get a fresh working dbh. Bye, -- Pedro Melo @pedromelo http://www.simplicidade.org/ xmpp:m...@simplicidade.org mailto:m...@simplicidade.org ------------------------------------------------------------------------------ Own the Future-Intel® Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users