<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: 'Calibri'; COLOR: #000000">
<DIV>I’m using D1, and have a before hook that sets a var with a payload of 
session/client-specific values.  This works well when running D1 normally 
as a web app.  However there are a few tasks that need to run via a daily 
cron job, for which I load D1 manually.  In those cases I lose the vars 
setting, even if I set them manually, knowing the hook does not execute.</DIV>
<DIV> </DIV>
<DIV>The following snippet:</DIV>
<DIV> </DIV>
<DIV>  use strict;</DIV>
<DIV>  use Dancer ':syntax';  </DIV>
<DIV>  Dancer::Config::setting('appdir', '/home/s1/www/');</DIV>
<DIV>  Dancer::Config::setting('views', '/home/s1/www/views');</DIV>
<DIV>  config->{'environment'} = 'development';</DIV>
<DIV>  Dancer::Config::load();</DIV>
<DIV> </DIV>
<DIV>  var hello => "hi, I used var";</DIV>
<DIV>  set hello => "hi, I used set";</DIV>
<DIV> </DIV>
<DIV>  print template('test', 
{});          # uses Template 
Toolkit</DIV>
<DIV> </DIV>
<DIV>with the following template test.tt:</DIV>
<DIV> </DIV>
<DIV>  Hello using vars = <% vars.hello %></DIV>
<DIV>  Hello using settings = <% settings.hello %></DIV>
<DIV> </DIV>
<DIV>yields:</DIV>
<DIV> </DIV>
<DIV>  Hello using vars =</DIV>
<DIV>  Hello using settings = hi, I used set</DIV>
<DIV> </DIV>
<DIV>In this case, ‘vars’ is not passed on to Template Tookit, whereas 
‘settings’ is.  If I had run this within a normal D1 route, ‘vars’ would 
have been passed.</DIV>
<DIV> </DIV>
<DIV>So it appears I need to refactor the entire (large) application to use 
“set” and not “var”.  Is this correct?  Why isn’t “var” the correct 
option here?  Or if it is, what am I doing wrong?</DIV>
<DIV> </DIV>
<DIV>Thx in advance!</DIV>
<DIV>Hermann</DIV>
<DIV> </DIV></DIV></DIV></BODY></HTML>