From: Kennedy Clark Date: Wed, 17 Feb 2010 03:09:39 +0000 (+0000) Subject: Convert to newer style for stash X-Git-Tag: v5.8005~35 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=commitdiff_plain;h=6c0f71ee33481d3a2793a4e4a94cb6172a4971b2 Convert to newer style for stash Convert to -r for server Misc changes --- diff --git a/lib/Catalyst/Manual/Tutorial/06_Authorization.pod b/lib/Catalyst/Manual/Tutorial/06_Authorization.pod index 9302abb..456c5e5 100644 --- a/lib/Catalyst/Manual/Tutorial/06_Authorization.pod +++ b/lib/Catalyst/Manual/Tutorial/06_Authorization.pod @@ -78,21 +78,21 @@ Catalyst. Edit C and add C to the list: - # Load plugins - use Catalyst qw/ - -Debug - ConfigLoader - Static::Simple - - StackTrace - - Authentication - Authorization::Roles - - Session - Session::Store::FastMmap - Session::State::Cookie - /; + # Load plugins + use Catalyst qw/ + -Debug + ConfigLoader + Static::Simple + + StackTrace + + Authentication + Authorization::Roles + + Session + Session::Store::FastMmap + Session::State::Cookie + /; Once again, include this additional plugin as a new dependency in the Makefile.PL file like this: @@ -172,11 +172,9 @@ updating C to match the following code: # Note: Above is a shortcut for this: # $book->create_related('book_authors', {author_id => $author_id}); - # Assign the Book object to the stash for display in the view - $c->stash->{book} = $book; - - # Set the TT template to use - $c->stash->{template} = 'books/create_done.tt2'; + # Assign the Book object to the stash and set template + $c->stash(book => $book, + template => 'books/create_done.tt2'); } else { # Provide very simple feedback to the user. $c->response->body('Unauthorized!'); @@ -202,10 +200,9 @@ C and C<=end> after the closing C<}>. =head2 Try Out Authentication And Authorization -Press C to kill the previous server instance (if it's still -running) and restart it: +Make sure the development server is running: - $ script/myapp_server.pl + $ script/myapp_server.pl -r Now trying going to L and you should be taken to the login page (you might have to C or @@ -314,7 +311,7 @@ C and add this method: sub error_noperms :Chained('/') :PathPart('error_noperms') :Args(0) { my ($self, $c) = @_; - $c->stash->{template} = 'error_noperms.tt2'; + $c->stash(template => 'error_noperms.tt2'); } And also add the template file by putting the following text into @@ -322,10 +319,6 @@ C: Permission Denied -Then run the Catalyst development server script: - - $ script/myapp_server.pl - Log in as C and create several new books using the C feature: