Permalink
Browse files

deprecate layout

  • Loading branch information...
1 parent 7166136 commit 11c0dc6b7cbfe1c3a4ceec305d7c7500b9f93cf5 @ambs ambs committed May 8, 2011
View
@@ -4,6 +4,9 @@
* When scaffolding an app, show a warning if YAML not installed.
Prompted by Issue 496. (David Precious)
+ [ DEPRECATIONS ]
+ * Deprecate 'layout' (use set). (Alberto Simões)
+
1.3040 01.05.2011
** Codename: Yanick in Black // Yanick Champoux, Labor Day - May Day **
View
@@ -14,8 +14,7 @@
set 'warnings' => 1;
set 'username' => 'admin';
set 'password' => 'password';
-
-layout 'main';
+set 'layout' => 'main';
my $flash;
View
@@ -121,7 +121,11 @@ sub halt { Dancer::SharedData->response->halt(@_) }
sub header { goto &headers }
sub push_header { Dancer::SharedData->response->push_header(@_); }
sub headers { Dancer::SharedData->response->headers(@_); }
-sub layout { set(layout => shift) }
+sub layout {
+ Dancer::Deprecation->deprecated(reason => "use 'set layout => \"value\"'",
+ version => '1.3050',
+ fatal => 0);
+ set(layout => shift) }
sub load { require $_ for @_ }
sub load_app { goto &_load_app } # goto doesn't add a call frame. So caller() will work as expected
sub logger { set(logger => @_) }
@@ -738,10 +742,9 @@ Do the same as C<header>, but allow for multiple headers with the same name.
=head2 layout
-Allows you to set the default layout to use when rendering a view. Syntactic
-sugar around the C<layout> setting:
+This method is deprecated. Use C<set>:
- layout 'user';
+ set layout => 'user';
=head2 logger
View
@@ -527,7 +527,7 @@ Here is an example of a layout: C<views/layouts/main.tt> :
You can tell your app which layout to use with C<layout: name> in the config
file, or within your code:
- layout 'main';
+ set layout => 'main';
You can control which layout to use (or whether to use a layout at all) for a
specific request without altering the layout setting by passing an options
View
@@ -366,7 +366,7 @@ I mentioned near the beginning of this tutorial that it is possible to create a
C<layout> template. In Dancr, that layout is called C<main> and it's set up by
putting in a directive like this:
- layout 'main';
+ set layout => 'main';
near the top of your web application. What this tells Dancer's template engine
is that it should look for a file called F<main.tt> in C<dancr/views/layouts/>
@@ -448,8 +448,7 @@ Here's the complete dancr.pl script from start to finish.
set 'warnings' => 1;
set 'username' => 'admin';
set 'password' => 'password';
-
- layout 'main';
+ set 'layout' => 'main';
my $flash;
View
@@ -63,12 +63,12 @@ get '/solo' => sub {
};
get '/full' => sub {
- layout 'main';
+ set layout => 'main';
template 't03';
};
get '/layoutdisabled' => sub {
- layout 'main';
+ set layout => 'main';
template 't03', {}, { layout => undef };
};
@@ -25,7 +25,7 @@ response_content_like( [ GET => '/' ], qr/foo => bar/ );
ok(
get '/layout_empty_params_passed' => sub {
- layout 'main';
+ set layout => 'main';
template 'index', {};
}
);
@@ -35,7 +35,7 @@ response_content_like( [ GET => '/layout_empty_params_passed' ], qr/layout:bar\n
ok(
get '/layout_but_no_params_passed' => sub {
- layout 'main';
+ set layout => 'main';
template 'index';
}
);

0 comments on commit 11c0dc6

Please sign in to comment.