[Catalyst-commits] r13890 - trunk/examples/CatalystAdvent/root/2010

lukast at dev.catalyst.perl.org lukast at dev.catalyst.perl.org
Thu Dec 23 19:16:52 GMT 2010


Author: lukast
Date: 2010-12-23 19:16:52 +0000 (Thu, 23 Dec 2010)
New Revision: 13890

Modified:
   trunk/examples/CatalystAdvent/root/2010/22.pod
   trunk/examples/CatalystAdvent/root/2010/23.pod
Log:
minor changes in 22.pod and 23.pod

Modified: trunk/examples/CatalystAdvent/root/2010/22.pod
===================================================================
--- trunk/examples/CatalystAdvent/root/2010/22.pod	2010-12-23 15:03:47 UTC (rev 13889)
+++ trunk/examples/CatalystAdvent/root/2010/22.pod	2010-12-23 19:16:52 UTC (rev 13890)
@@ -343,7 +343,7 @@
 
  <tr>
  <th>Title</th><th>Rating</th><th>Author(s)</th><th>Links</th>
- <th><input type="submit" name="multi_delete", value="delete selected"</th>
+ <th><input type="submit" name="multi_delete", value="delete selected"/></th>
  </tr>
 
 =item * add a checkbox for each displayed database-entry. Add, just before the </tr> tag inside the FOEARCH-loop:
@@ -362,7 +362,7 @@
  <table>
  <tr>
  <th>Title</th><th>Rating</th><th>Author(s)</th><th>Links</th>
- <th><input type="submit" name="multi_delete", value="delete selected"</th>
+ <th><input type="submit" name="multi_delete", value="delete selected"/></th>
  </tr>
  [% # Display each book in a table row %]
  [% FOREACH book IN books -%]

Modified: trunk/examples/CatalystAdvent/root/2010/23.pod
===================================================================
--- trunk/examples/CatalystAdvent/root/2010/23.pod	2010-12-23 15:03:47 UTC (rev 13889)
+++ trunk/examples/CatalystAdvent/root/2010/23.pod	2010-12-23 19:16:52 UTC (rev 13890)
@@ -5,7 +5,6 @@
 L<Yesterdays article|http://www.catalystframework.org/calendar/2010/22> gave 
 a short introduction on how to create reusable actions with the help of 
 Moose::Role.
-
 Todays article will deepen this topic and demonstrate how to create reusable
 DBIx::Class based schemas.
 
@@ -42,14 +41,16 @@
 L<here|http://public.thiemeier.net/download/CatalystAdvent_2010_22-01.tar.bz2>.
 
 =item * Unpack it by running 
+
  lukast at Mynx:~/src$ tar -xf CatalystAdvent_2010_22.tar.bz2
 
 =back
 
 =item * Install the dependecies:
+
  lukast at Mynx:~/src$ cpan XML::Simple MooseX::NonMoose Moose::Util
 
-=item * as in yesterdays example, the following credentials can be used to log in to the application:
+=item * the following credentials can be used to log in to the application:
 
 =over 
 
@@ -109,11 +110,13 @@
 =head3 Updating the View
 
 We will reuse our multiaction templates and just add a "export selected" button. Open "root/src/book/list.tt2" and add
+
  <input type="submit" name="multi_export", value="export selected"/>
+
 anywhere inside the multiaction form, but ouside the FOREACH loop. 
 (For example next to the delete-button, in the same table header field)
 
-We will have to adapt our multiactions behaviour to make this work. 
+Note: We will have to adapt our multiactions behaviour to make this work. 
 
 =head3 Implementing the Controller Role
 
@@ -139,7 +142,7 @@
 
 =item * methods 
 
-=over
+=over 
 
 =item * createxml :Private
 
@@ -150,7 +153,7 @@
 
 =item * parameters
 
-=over
+=over 
 
 =item * $rootname
 
@@ -251,9 +254,11 @@
  1;
 
 The line 
+
  ensure_all_roles($rs, qw/MyApp::SchemaRole::ResultSet::XmlExport/);
+
 applies the Role "MyApp::SchemaRole::ResultSet::XmlExport" to the resultset, if
-the resultset does not yet consume the role. 
+the resultset does not yet consume that role. 
 By using this feature of Moose::Util, 
 it is possible to add functionality to the resultset without the need to create
 or adapt a resultset. See "Updating the Schema" below for more information.
@@ -297,6 +302,10 @@
 
 to your __PACKAGE__->config(...) section at the bottom of the file.
 
+As you can see, the export method is chained to "objectgroup", which retrieves
+the selected dataset and stores the resultset to stash, where it can be found
+by the export method.
+
 =item * adapt the multiaction
 
 Since we are using our multiactions form to select database entries, 
@@ -474,7 +483,7 @@
 =head3 Updating the Schema
 
 As already stated before, Moose::Util makes it possible to apply roles to
-classes or objects on demand. This makes it possible to consume our SchemaRoles
+classes or objects on demand. This bringds us in the position to consume our SchemaRoles
 without the need to change the model.
 
 If it is necessary to change the roles behaviour, it is possible to use
@@ -489,6 +498,7 @@
 =over 
 
 =item * start the application:
+
  lukast at Mynx:~/src/MyApp_Chapter5/MyApp$ script/myapp_server.pl 
 
 =item * point your browser to "localhost:3000/books/list"
@@ -535,6 +545,7 @@
   	rootname "book listing"
  </Controller::Books>
 
+Alternatively, you can configure the controller in "lib/MyApp.pm"
 
 =head3 Result modification
 
@@ -546,13 +557,15 @@
 
 =over
 
-=item * To use the around-pragme provided by Moose, it is necessary to consume
+=item * Prepare the Result class
+
+To use the around-pragme provided by Moose, it is necessary to consume
 the role in the schema-file itself. Relying on "Moose::Util" will result in a
 compile-time error, because the role is added at runtime. A statement like 
 "around xml_data => sub{...}" will fail, because the modified method (xml_data)
 is not present at compile time.
 
-Edit the head of lib/MyApp/Schema/Result/Book.pm and replace the line 
+Edit the head of "lib/MyApp/Schema/Result/Book.pm" and replace the line 
 "use base DBIx::Class::Core" with 
  
  use Moose;
@@ -561,7 +574,9 @@
  extends 'DBIx::Class::Core';
  with 'MyApp::SchemaRole::Result::XmlExport';
 
-=item * modify the method my adding the following code anywhere before "1;", at
+=item * modify the method 
+
+Add the following code anywhere before "1;", at
 the bottom of the file:
 
  around xml_data => sub {




More information about the Catalyst-commits mailing list