Hello, why was the old behavior changed? Don't you think the new way with 3 lines of code is too complex? ps: I actively use 'template' to generate config files and emails too. Mostly (but not only) in "use Dancer ':script'" mode. 16.12.2011 3:44, damien krotkine пишет:
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@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@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
Dancer-users mailing list Dancer-users@perldancer.org http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
-- Best Regards, Nick Knutov http://knutov.com ICQ: 272873706 Voice: +7-904-84-23-130