[Dancer-users] Private template in Dancer

igor.bujna at post.cz igor.bujna at post.cz
Wed Jun 30 02:23:50 CEST 2010


Hello,
i make cleaner code for "private template". I use similar code as "before" filter. Better is when you looking my patch than I write how it works.  Now its simply and cleaner :)


> ------------ Původní zpráva ------------
> Od: David Precious <davidp at preshweb.co.uk>
> Předmět: Re: [Dancer-users] Private template in Dancer
> Datum: 15.6.2010 12:06:54
> ----------------------------------------
> On Tuesday 15 June 2010 09:18:11 Alexis Sukrieh wrote:
> > Le 15/06/2010 09:14, igor.bujna at post.cz a écrit :
> > > Now in
> > > every template i can use this variables via 'private' call. It must be
> > > enabled for every template via set private_template =>  '1' Or can
> > > enabled or disabled separately in options 'private_template' in given
> > > using template.
> > >
> > >   It would be good to make something similar in this framework.
> 
> > My first opinion is that using settings for private template variables
> > is not a good idea. Setting should remain.... setting ;)
> 
> Agreed :)
> 
> > We also had in mind to provide a new kind of hook, called
> > "before_template" which could process variables before any template is
> > called.
> 
> I would definitely agree, this is a good case where using a before_template 
> hook would be nice, it could inject whatever params it wanted into the hashref 
> of params about to be passed off to the template.
> 
> FWIW, one way that may be suitable to handle this is to shove something in the 
> session, if you're using sessions, then the template can access that.
> 
> For instance, 
> 
> session 'foo' => $foo;
> 
> Then, in the template,
> 
> [% session.foo %]
> 
> Once we have proper hook support, implementing it with a before_template hook 
> would probably be cleaner, though!
> 
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
> 
> 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: before_template
Type: text/x-diff
Size: 6249 bytes
Desc: not available
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20100630/57e5dc7f/attachment.diff>


More information about the Dancer-users mailing list