Hey everyone.

Thank you for raising this issue! We didn't notice how this change would affect users, and we apologize. Damien has reverted the commit and I'll bet putting out a new release today with the template() keyword being what it was - a way to return rendered output. This is because it is commonly used this way and apparently that's the DWIMish usage of it.

Thanks again for providing such fast and helpful feedback, and thank you, dams, for responding to it and working it out so quickly! :)

S.

On Fri, Dec 16, 2011 at 1:13 AM, Sarah Fuller <sarah@averna.id.au> wrote:
Heya,

I'd also love to know why this change was done. I've got a number of apps that rely on this template behaviour for sending out html emails.
Most respectfully and curiously, if the new behaviour is here to stay it would be a lot easier getting on with updating my code if I know why this change was made.

Thank you. :)

Sarah.



On Fri, Dec 16, 2011 at 8:52 AM, Nick Knutov <mail@knutov.com> wrote:
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

_______________________________________________
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