[Dancer-users] Dancer::layout has been deprecated

David Precious davidp at preshweb.co.uk
Sat May 21 23:33:08 CEST 2011



"Nick Knutov" <mail at knutov.com> wrote:

>I see message
>
>Dancer::layout has been deprecated since version 1.3050. use 'set
>layout 
>=> "value"'
>
>But why was it done?
>
>For example:
>
>get '/' => sub {
>	# do something
>	my $message = template 'message', $data, {layout=>''};
>	# sending email with $message or inserting parsed data to DB
>	# do something else
>	template 'index', $data;
>};
>
>So, in the new way I should read current setting('layout'), save it,
>set 
>up new layout and restore old layout after if the old-style layout
>setup 
>will be deprecated. This is ugly!

No, setting the layout via the 'layout' option to the template() keyword should still be supported - it's just the layout() keyword which has been deprecated. 

So,

    layout 'foo';

Becomes:

    set layout => 'foo';

You can still override the layout setting when calling layout:

    template 'foo', \%tokens, { layout => 'bar';


-- 
David Precious <davidp at preshweb.co.uk>
Sent from my phone so please excuse brevity / poor quoting style etc


More information about the Dancer-users mailing list