remove trailing whitespace
[catagits/Catalyst-Manual.git] / lib / Catalyst / Manual / Tutorial / 03_MoreCatalystBasics.pod
index a138526..9bf0ce3 100644 (file)
@@ -134,7 +134,7 @@ but a I<flag>.  Although most of the items specified on the C<use
 Catalyst> line of your application class will be plugins, Catalyst
 supports a limited number of flag options (of these, C<-Debug> is the
 most common).  See the documentation for
-C<https://metacpan.org/module/Catalyst|Catalyst.pm> to get details on
+L<https://metacpan.org/module/Catalyst|Catalyst.pm> to get details on
 other flags (currently C<-Engine>, C<-Home>, C<-Log>, and C<-Stats>).
 
 If you prefer, there are several other ways to enable debug output:
@@ -223,7 +223,7 @@ Then replace it with:
         -Debug
         ConfigLoader
         Static::Simple
-    
+
         StackTrace
     /;
 
@@ -282,7 +282,7 @@ and open C<http://localhost:3000/> in your browser.  You should get a
 screen that starts with "Caught exception in
 MyApp::Controller::Root->index" with sections showing a stacktrace,
 information about the Request and Response objects, the stash (something
-we will learn about soon), the applications configuration configuration.
+we will learn about soon), and the applications configuration.
 B<Just don't forget to remove the die before you continue the tutorial!>
 :-)
 
@@ -311,23 +311,23 @@ each of the three parts of MVC: C<Model>, C<View> and C<Controller>)
 and add the following method to the controller:
 
     =head2 list
-    
+
     Fetch all book objects and pass to books/list.tt2 in stash to be displayed
-    
+
     =cut
-    
+
     sub list :Local {
         # Retrieve the usual Perl OO '$self' for this object. $c is the Catalyst
         # 'Context' that's used to 'glue together' the various components
         # that make up the application
         my ($self, $c) = @_;
-    
+
         # Retrieve all of the book records as book model objects and store in the
         # stash where they can be accessed by the TT template
         # $c->stash(books => [$c->model('DB::Book')->all]);
         # But, for now, use this code until we create the model later
         $c->stash(books => '');
-    
+
         # Set the TT template to use.  You will almost always want to do this
         # in your action methods (action methods respond to user input in
         # your controllers).
@@ -400,7 +400,7 @@ C<lib/MyApp/Controller/Books.pm> would match on the URL
 C<http://localhost:3000/books/list>, but "C<:Path('/list')>" would match
 on C<http://localhost:3000/list> (because of the leading slash).  You
 can use C<:Args()> to specify how many arguments an action should
-accept.  See L<Catalyst::Manual::Intro/Action_types> for more
+accept.  See L<Catalyst::Manual::Intro/Action-types> for more
 information and examples.
 
 =item *
@@ -531,7 +531,7 @@ C<root/src>.
 
 Please stick with the settings above for the duration of the tutorial,
 but feel free to use whatever options you desire in your applications
-(as with most things Perl, there's more than one way to do it...).
+(as with most things in Perl, there's more than one way to do it...).
 
 B<Note:> We will use C<root/src> as the base directory for our template
 files, with a full naming convention of
@@ -549,14 +549,14 @@ First create a directory for book-related TT templates:
 Then create C<root/src/books/list.tt2> in your editor and enter:
 
     [% # This is a TT comment. -%]
-    
+
     [%- # Provide a title -%]
     [% META title = 'Book List' -%]
-    
+
     [% # Note That the '-' at the beginning or end of TT code  -%]
     [% # "chomps" the whitespace/newline at that end of the    -%]
     [% # output (use View Source in browser to see the effect) -%]
-    
+
     [% # Some basic HTML with a loop to display books -%]
     <table>
     <tr><th>Title</th><th>Rating</th><th>Author(s)</th></tr>
@@ -855,8 +855,8 @@ when you launch the application).
 Additionally, the C<lib/MyApp/Schema.pm> model can easily be loaded
 outside of Catalyst, for example, in command-line utilities and/or cron
 jobs. C<lib/MyApp/Model/DB.pm> provides a very thin "bridge" between
-Catalyst this external database model.  Once you see how we can add some
-powerful features to our DBIC model in
+Catalyst and this external database model.  Once you see how we can
+add some powerful features to our DBIC model in
 L<Chapter 4|Catalyst::Manual::Tutorial::04_BasicCRUD>, the elegance
 of this approach will start to become more obvious.
 
@@ -881,26 +881,26 @@ L<DBIx::Class::Schema::Loader> version C<0.05000> or later.
 =head1 ENABLE THE MODEL IN THE CONTROLLER
 
 Open C<lib/MyApp/Controller/Books.pm> and un-comment the model code we
-left disabled earlier so that your version matches the following (un-
-comment the line containing C<[$c-E<gt>model('DB::Book')-E<gt>all]> and
-delete the next 2 lines):
+left disabled earlier so that your version matches the following
+(un-comment the line containing C<[$c-E<gt>model('DB::Book')-E<gt>all]>
+and delete the next 2 lines):
 
     =head2 list
-    
+
     Fetch all book objects and pass to books/list.tt2 in stash to be displayed
-    
+
     =cut
-    
+
     sub list :Local {
         # Retrieve the usual Perl OO '$self' for this object. $c is the Catalyst
         # 'Context' that's used to 'glue together' the various components
         # that make up the application
         my ($self, $c) = @_;
-    
+
         # Retrieve all of the book records as book model objects and store
         # in the stash where they can be accessed by the TT template
         $c->stash(books => [$c->model('DB::Book')->all]);
-    
+
         # Set the TT template to use.  You will almost always want to do this
         # in your action methods (action methods respond to user input in
         # your controllers).
@@ -959,7 +959,7 @@ display something like:
     | Catalyst::Plugin::ConfigLoader  0.30                                       |
     | Catalyst::Plugin::StackTrace  0.11                                         |
     '----------------------------------------------------------------------------'
-    
+
     [debug] Loaded dispatcher "Catalyst::Dispatcher"
     [debug] Loaded engine "Catalyst::Engine"
     [debug] Found home "/home/catalyst/MyApp"
@@ -976,7 +976,7 @@ display something like:
     | MyApp::Model::DB::BookAuthor                                    | class    |
     | MyApp::View::HTML                                               | instance |
     '-----------------------------------------------------------------+----------'
-    
+
     [debug] Loaded Private actions:
     .----------------------+--------------------------------------+--------------.
     | Private              | Class                                | Method       |
@@ -987,7 +987,7 @@ display something like:
     | /books/index         | MyApp::Controller::Books             | index        |
     | /books/list          | MyApp::Controller::Books             | list         |
     '----------------------+--------------------------------------+--------------'
-    
+
     [debug] Loaded Path actions:
     .-------------------------------------+--------------------------------------.
     | Path                                | Private                              |
@@ -997,7 +997,7 @@ display something like:
     | /books                              | /books/index                         |
     | /books/list                         | /books/list                          |
     '-------------------------------------+--------------------------------------'
-    
+
     [info] MyApp powered by Catalyst 5.80020
     HTTP::Server::PSGI: Accepting connections at http://0:3000
 
@@ -1091,7 +1091,7 @@ the tutorial, open C<root/src/wrapper.tt2> and input the following:
     <title>[% template.title or "My Catalyst App!" %]</title>
     <link rel="stylesheet" href="[% c.uri_for('/static/css/main.css') %]" />
     </head>
-    
+
     <body>
     <div id="outer">
     <div id="header">
@@ -1100,7 +1100,7 @@ the tutorial, open C<root/src/wrapper.tt2> and input the following:
         [%# Insert the page title -%]
         <h1>[% template.title or site.title %]</h1>
     </div>
-    
+
     <div id="bodyblock">
     <div id="menu">
         Navigation:
@@ -1110,7 +1110,7 @@ the tutorial, open C<root/src/wrapper.tt2> and input the following:
                 %]" title="Catalyst Welcome Page">Welcome</a></li>
         </ul>
     </div><!-- end menu -->
-    
+
     <div id="content">
         [%# Status and error messages %]
         <span class="message">[% status_msg %]</span>
@@ -1119,10 +1119,10 @@ the tutorial, open C<root/src/wrapper.tt2> and input the following:
         [% content %]
     </div><!-- end content -->
     </div><!-- end bodyblock -->
-    
+
     <div id="footer">Copyright (c) your name goes here</div>
     </div><!-- end outer -->
-    
+
     </body>
     </html>
 
@@ -1237,15 +1237,15 @@ keys. For example, take a look at C<lib/MyApp/Schema/Result/Book.pm> and
 notice the following code:
 
     =head1 RELATIONS
-    
+
     =head2 book_authors
-    
+
     Type: has_many
-    
+
     Related object: L<MyApp::Schema::Result::BookAuthor>
-    
+
     =cut
-    
+
     __PACKAGE__->has_many(
       "book_authors",
       "MyApp::Schema::Result::BookAuthor",
@@ -1306,15 +1306,15 @@ there is a C<belongs_to> relationship defined that acts as the "mirror
 image" to the C<has_many> relationship we just looked at above:
 
     =head1 RELATIONS
-    
+
     =head2 book
-    
+
     Type: belongs_to
-    
+
     Related object: L<MyApp::Schema::Result::Book>
-    
+
     =cut
-    
+
     __PACKAGE__->belongs_to(
       "book",
       "MyApp::Schema::Result::Book",
@@ -1381,7 +1381,7 @@ alternate way to specify the trace option just in case):
     $ DBIC_TRACE=1 script/myapp_server.pl -r
 
 Make sure that the application loads correctly and that you see the
-three dynamically created model class (one for each of the Result
+three dynamically created model classes (one for each of the Result
 Classes we created).
 
 Then hit the URL L<http://localhost:3000/books/list> with your browser
@@ -1442,15 +1442,15 @@ debug output (one for each book as the authors are being retrieved by
 DBIx::Class):
 
     SELECT me.id, me.title, me.rating FROM book me:
-    SELECT author.id, author.first_name, author.last_name FROM book_author me  
+    SELECT author.id, author.first_name, author.last_name FROM book_author me
     JOIN author author ON author.id = me.author_id WHERE ( me.book_id = ? ): '1'
-    SELECT author.id, author.first_name, author.last_name FROM book_author me  
+    SELECT author.id, author.first_name, author.last_name FROM book_author me
     JOIN author author ON author.id = me.author_id WHERE ( me.book_id = ? ): '2'
-    SELECT author.id, author.first_name, author.last_name FROM book_author me  
+    SELECT author.id, author.first_name, author.last_name FROM book_author me
     JOIN author author ON author.id = me.author_id WHERE ( me.book_id = ? ): '3'
-    SELECT author.id, author.first_name, author.last_name FROM book_author me  
+    SELECT author.id, author.first_name, author.last_name FROM book_author me
     JOIN author author ON author.id = me.author_id WHERE ( me.book_id = ? ): '4'
-    SELECT author.id, author.first_name, author.last_name FROM book_author me  
+    SELECT author.id, author.first_name, author.last_name FROM book_author me
     JOIN author author ON author.id = me.author_id WHERE ( me.book_id = ? ): '5'
 
 Also note in C<root/src/books/list.tt2> that we are using "| html", a
@@ -1461,11 +1461,11 @@ html" at the end of every field where a user has control over the
 information that can appear in that field (and can therefore inject
 markup or code if you don't "neutralize" those fields).  In addition to
 "| html", Template Toolkit has a variety of other useful filters that
-can found in the documentation for L<Template::Filters>.  (While we are
-on the topic of security and escaping of dangerous values, one of the
-advantages of using tools like DBIC for database access or
+can be found in the documentation for L<Template::Filters>.  (While we
+are on the topic of security and escaping of dangerous values, one of
+the advantages of using tools like DBIC for database access or
 L<HTML::FormFu> for form management [see
-L<Chapter 9|Catalyst::Manual::Tutorial::09_AdvancedCRUD::09_FormFu>
+L<Chapter 9|Catalyst::Manual::Tutorial::09_AdvancedCRUD::09_FormFu>]
 is that they automatically handle most escaping for you and therefore
 dramatically increase the security of your app.)
 
@@ -1474,7 +1474,7 @@ dramatically increase the security of your app.)
 
 In some situations, it can be useful to run your application and display
 a page without using a browser.  Catalyst lets you do this using the
-C<scripts/myapp_test.pl> script.  Just supply the URL you wish to
+C<script/myapp_test.pl> script.  Just supply the URL you wish to
 display and it will run that request through the normal controller
 dispatch logic and use the appropriate view to render the output
 (obviously, complex pages may dump a lot of text to your terminal
@@ -1564,7 +1564,7 @@ this URL:
 
 You should get a page with the following message at the top:
 
-    Caught exception in MyApp::Controller::Root->end "Forced debug - 
+    Caught exception in MyApp::Controller::Root->end "Forced debug -
     Scrubbed output at /usr/share/perl5/Catalyst/Action/RenderView.pm line 46."
 
 Along with a summary of your application's state at the end of the
@@ -1594,21 +1594,21 @@ this line to match the following (only the
 C<$c-E<gt>stash-E<gt>{template}> line has changed):
 
     =head2 list
-    
+
     Fetch all book objects and pass to books/list.tt2 in stash to be displayed
-    
+
     =cut
-    
+
     sub list :Local {
         # Retrieve the usual Perl OO '$self' for this object. $c is the Catalyst
         # 'Context' that's used to 'glue together' the various components
         # that make up the application
         my ($self, $c) = @_;
-    
+
         # Retrieve all of the book records as book model objects and store in the
         # stash where they can be accessed by the TT template
         $c->stash(books => [$c->model('DB::Book')->all]);
-    
+
         # Set the TT template to use.  You will almost always want to do this
         # in your action methods (actions methods respond to user input in
         # your controllers).
@@ -1619,12 +1619,12 @@ C<$c-E<gt>stash-E<gt>{template}> line has changed):
 You should now be able to access the L<http://localhost:3000/books/list>
 URL as before.
 
-B<NOTE:> Please note that if you use the default template technique, you
+B<NOTE:> If you use the default template technique, you
 will B<not> be able to use either the C<$c-E<gt>forward> or the
 C<$c-E<gt>detach> mechanisms (these are discussed in Chapter 2 and
 Chapter 9 of the Tutorial).
 
-B<IMPORTANT:> Make sure that you do NOT skip the following section
+B<IMPORTANT:> Make sure that you do B<not> skip the following section
 before continuing to the next chapter 4 Basic CRUD.