[Dancer-users] Dancer qw(:script) - possible bug with template

Nick Knutov mail at knutov.com
Sun Jul 3 13:10:23 CEST 2011

 > engine('template')->render

At the first look it's working solution, but it seems that I should add 
path to views to the template path. It looks like a bug too.

03.07.2011 16:50, David Precious пишет:
> "Nick Knutov"<mail at knutov.com>  wrote:
>> use Dancer qw(:script);
>> use myapp;
>> [...]
>> my $report = template '...', {foo=>'bar'}, {layout=>''};
>> Can't call method "params" on an undefined value at
>> /usr/local/share/perl/5.10.1/Dancer/Template/Abstract.pm line 112.
>> Is it a bug? Or what I'm doing wrong?
> Looks like template() expects to be called within a route handler where there's a request being processed, but you're using it outside of routes in a simple script.
> It should be possible to amend template() to check if there's a request and if not, skip adding params as a token - I'll take a look soon.
> In the meantime you may be able to call e.g. engine('template')->render or similar.

Best Regards,
Nick Knutov
ICQ: 272873706
Voice: +7-904-84-23-130

More information about the Dancer-users mailing list