[Dancer-users] bug with multiple "template" calls ?
damien krotkine
dkrotkine at gmail.com
Thu Dec 15 22:44:21 CET 2011
Hi Assaf,
Well, the standard way of doing waht you wish to do is to use these
line of codes instead of using template :
my $template_engine = engine 'template';
my $html = $template_engine->apply_renderer(...);
my $html_with_layout = $template_engine->apply_layout($html);
I can see that the new release is causing you a problem, as it breaks
something that used to work.
I'll see with Sawyer and other core devs what we do. On top of my head
what we can do is either :
- just amend the documentation, and advertise a bit the potential issue
- change back the behaviour of template, and re-release
- perform the old behaviour if 'template' is called in a contexte that
is anything but 'void', and issue a warning
any other idea ?
On 15 December 2011 20:18, Assaf Gordon <gordon at cshl.edu> wrote:
> Hello,
>
> In my dancer application, I'm using "template" to create documents that are not necessarily displayed as HTML (they are message bodies that will be sent with Dancer::Plugin::Email).
>
> I have one (or more) calls to "template" to create the email text.
> and the last "template" creates the HTML page.
>
>
> Conceptual example:
> ====
> get "/hello" => sub {
> my $name = params->{name};
> my $email = params->{email};
>
> ## Email to be sent to the user, NOT rendered as HTML.
> my $msg = template("email_body", { name => $name }, { layout => undef } ) ;
> my $subject = template("email_subject", { name => $name }, { layout => undef } ) ;
> email { message => $msg,
> subject => $subject,
> to => $email } ;
>
> ## The welcome page, sent back to the user
> return template("welcome", { name => $name, email => $email } ) ;
> }
> =====
>
> With Dancer version 1.3079_3, it worked perfectly.
> After upgrading to 1.3090, the result of the first template is always returned to the user - what changed ? any ideas/suggestions are welcomed.
>
> Thanks,
> -gordon
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
More information about the Dancer-users
mailing list