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>

% $m->call_next('config' => \%config); # pass the parameter to other files.

Now you can get access to these variables from any file like this:
<%args>
   %config => ''
<%/args>

$config{site}{bg_color}

Hope this helps
Shiladitya Biswas

On Tue, Mar 3, 2009 at 8:00 PM, Jonathan Swartz <swa...@pobox.com> wrote:
> Can you be more specific about "variables"? Are these constants that
> change on a page-by-page basis, but otherwise don't need to change
> during the request? Do they have a lifetime of one request or longer
> than that?
>
> On Mar 3, 2009, at 6:19 AM, Louis-David Mitterrand wrote:
>
>> Hi,
>>
>> What is the best way to centrally store site-wide variables (ad code,
>> etc.)?
>>
>> I was thinking of putting them in the autohandler's <%attr> section
>> but
>> then how do I access the autohandler component? Is there a global
>> pointer to the autohandler?
>>
>>
>> --
>> http://www.critikart.net
>>
>> ------------------------------------------------------------------------------
>> 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
>
>
> ------------------------------------------------------------------------------
> 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
>



-- 
Shiladitya
------------------------------------------------------------------------
"If I Had More Time I Would Write a Shorter Letter"
 -- Blaise Pascal

------------------------------------------------------------------------------
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

Reply via email to