i love such liddle funktions as FILTER :)

in View::TT

__PACKAGE__->config(
   {
       CATALYST_VAR => 'catalyst',
       ...
       FILTERS => {
           yesno     => sub {
               $_[0] ? 'yes' : 'no';
           },
           onoff     => sub {
               $_[0] ? 'on' : 'off';
           },
       },
   },
);


so i can write in the template

Newsletter: [% user.newsletter | yesno %]


or your mk_hash:

[% somedata | mk_hash %]


Rajeev Cyrus schrieb:
Greetings.

One of my TT pages required some massaging of data that I decided to do via referencing a subroutine in a template variable, eg:
$c->stash->{mk_hash} = \&mk_hash;

I would like to use this stashed variable on all of my templates so my question is: Where is the best place to initialize and set this variable? Where should i declare the mk_hash method? Is there some way I can configure catalyst to set certain template variables when the application starts?

Thanks!

-Rajeev Cyrus



_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/




--
Mit freundlichen Grüßen

Felix Antonius Wilhelm Ostmann
--------------------------------------------------
Websuche   Search   Technology   GmbH   &   Co. KG
Martinistraße 3  -  D-49080  Osnabrück  -  Germany
Tel.:   +49 541 40666-0 - Fax:    +49 541 40666-22
Email: [EMAIL PROTECTED] - Website: www.websuche.de
--------------------------------------------------
AG Osnabrück - HRA 200252 - Ust-Ident: DE814737310
Komplementärin:     Websuche   Search   Technology
Verwaltungs GmbH   -  AG Osnabrück  -   HRB 200359
Geschäftsführer:  Diplom Kaufmann Martin Steinkamp
--------------------------------------------------


_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to