Hi all, Shiladitya Biswas wrote: > Hi Louis, > I suggest you try this approach : > Create a file called global_config and store all your variables in a > PERL hash (you may use any datastructure, but hash works nicely ) > Your global config will look like this: > > <%perl> > my %data = (); > $data{site}{header_color} = '#123456'; > $data{site}{bg_color} = '#214365'; > ...... and so on > return %data; > <%/perl> > > Next, put these lines in your _autohandler: > <%args> > %config = $m->comp('/global_config'); > </%args>
I'm not sure what I've done is correct, but I've basically done the same thing as what Shiladitya suggests. In addition, I placed this hash in a Perl module which is use'd in my handler. I actually chose this approach in response to a similar question that I had asked a few months (or more) ago on this mailing list. As these "global variables" are used on almost every page, are generally small (in terms of memory usage), and are static (i.e., truly constant), I was getting tired of putting <%perl>...</%perl> to load the Perl module every time. Of course, I could have put them all into the autohandler...I can't quite remember why I didn't do that :-) -- I think it was because that Perl module that is loaded also has functions that I call very often, and not just constants. Anyway, what I did is another alternative for you. Ray ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H _______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users