[Catalyst-commits] r12817 - in trunk/examples/Tutorial: MyApp_Chapter3/MyApp/lib/MyApp/Controller MyApp_Chapter4/MyApp MyApp_Chapter4/MyApp/lib MyApp_Chapter4/MyApp/lib/MyApp MyApp_Chapter4/MyApp/lib/MyApp/Controller MyApp_Chapter4/MyApp/lib/MyApp/Model MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result MyApp_Chapter4/MyApp/lib/MyApp/View MyApp_Chapter4/MyApp/root/src MyApp_Chapter4/MyApp/root/static/css MyApp_Chapter4/MyApp/t

caelum at dev.catalyst.perl.org caelum at dev.catalyst.perl.org
Sun Feb 7 08:59:30 GMT 2010


Author: caelum
Date: 2010-02-07 08:59:27 +0000 (Sun, 07 Feb 2010)
New Revision: 12817

Modified:
   trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Controller/Books.pm
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/Changes
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/Makefile.PL
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp.pm
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Controller/Books.pm
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Controller/Root.pm
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Model/DB.pm
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema.pm
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result/Author.pm
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result/Book.pm
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/View/TT.pm
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/myapp.conf
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/myapp.db
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/myapp01.sql
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/root/src/wrapper.tt2
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/root/static/css/main.css
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/01app.t
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/controller_Books.t
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/model_DB.t
   trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/view_TT.t
Log:
update Chapter 4 (and a minor change to Chapter 3)

Modified: trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Controller/Books.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Controller/Books.pm	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Controller/Books.pm	2010-02-07 08:59:27 UTC (rev 12817)
@@ -45,7 +45,7 @@
     # 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).
-    $c->stash->{template} = 'books/list.tt2';
+    $c->stash(template => 'books/list.tt2');
 }
 
 =head1 LICENSE

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/Changes
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/Changes	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/Changes	2010-02-07 08:59:27 UTC (rev 12817)
@@ -1,4 +1,4 @@
 This file documents the revision history for Perl extension MyApp.
 
-0.01  2009-11-15 00:20:57
+0.01  2010-02-07 02:42:25
         - initial revision, generated by Catalyst

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/Makefile.PL
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/Makefile.PL	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/Makefile.PL	2010-02-07 08:59:27 UTC (rev 12817)
@@ -6,13 +6,16 @@
 name 'MyApp';
 all_from 'lib/MyApp.pm';
 
-requires 'Catalyst::Runtime' => '5.80013';
+requires 'Catalyst::Runtime' => '5.80018';
 requires 'Catalyst::Plugin::ConfigLoader';
 requires 'Catalyst::Plugin::Static::Simple';
+requires 'Catalyst::Plugin::StackTrace';
 requires 'Catalyst::Action::RenderView';
-requires 'parent';
+requires 'Moose';
+requires 'namespace::autoclean';
 requires 'Config::General'; # This should reflect the config file format you've chosen
                  # See Catalyst::Plugin::ConfigLoader for supported formats
+test_requires 'Test::More' => '0.88';
 catalyst;
 
 install_script glob('script/*.pl');

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Controller/Books.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Controller/Books.pm	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Controller/Books.pm	2010-02-07 08:59:27 UTC (rev 12817)
@@ -1,8 +1,8 @@
 package MyApp::Controller::Books;
+use Moose;
+use namespace::autoclean;
 
-use strict;
-use warnings;
-use parent 'Catalyst::Controller';
+BEGIN {extends 'Catalyst::Controller'; }
 
 =head1 NAME
 
@@ -16,7 +16,6 @@
 
 =cut
 
-
 =head2 index
 
 =cut
@@ -27,19 +26,12 @@
     $c->response->body('Matched MyApp::Controller::Books in Books.');
 }
 
-
 =head2 list
 
 Fetch all book objects and pass to books/list.tt2 in stash to be displayed
 
 =cut
 
-=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
@@ -53,10 +45,9 @@
     # 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).
-    $c->stash->{template} = 'books/list.tt2';
+    $c->stash(template => 'books/list.tt2');
 }
 
-
 =head2 base
 
 Can place common logic to start chained dispatch here
@@ -248,11 +239,6 @@
     $c->stash->{template} = 'books/list.tt2';
 }
 
-
-=head1 AUTHOR
-
-root
-
 =head1 LICENSE
 
 This library is free software. You can redistribute it and/or modify
@@ -260,4 +246,6 @@
 
 =cut
 
+__PACKAGE__->meta->make_immutable;
+
 1;

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Controller/Root.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Controller/Root.pm	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Controller/Root.pm	2010-02-07 08:59:27 UTC (rev 12817)
@@ -1,14 +1,14 @@
 package MyApp::Controller::Root;
+use Moose;
+use namespace::autoclean;
 
-use strict;
-use warnings;
-use parent 'Catalyst::Controller';
+BEGIN { extends 'Catalyst::Controller' }
 
 #
 # Sets the actions in this controller to be registered with no prefix
 # so they function identically to actions created in MyApp.pm
 #
-__PACKAGE__->config->{namespace} = '';
+__PACKAGE__->config(namespace => '');
 
 =head1 NAME
 
@@ -20,10 +20,10 @@
 
 =head1 METHODS
 
-=cut
-
 =head2 index
 
+The root page (/)
+
 =cut
 
 sub index :Path :Args(0) {
@@ -33,6 +33,12 @@
     $c->response->body( $c->welcome_message );
 }
 
+=head2 default
+
+Standard 404 error page
+
+=cut
+
 sub default :Path {
     my ( $self, $c ) = @_;
     $c->response->body( 'Page not found' );
@@ -47,10 +53,6 @@
 
 sub end : ActionClass('RenderView') {}
 
-=head1 AUTHOR
-
-root
-
 =head1 LICENSE
 
 This library is free software. You can redistribute it and/or modify
@@ -58,4 +60,6 @@
 
 =cut
 
+__PACKAGE__->meta->make_immutable;
+
 1;

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Model/DB.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Model/DB.pm	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Model/DB.pm	2010-02-07 08:59:27 UTC (rev 12817)
@@ -10,6 +10,7 @@
         dsn => 'dbi:SQLite:myapp.db',
         user => '',
         password => '',
+        on_connect_do => q{PRAGMA foreign_keys = ON},
     }
 );
 
@@ -27,12 +28,8 @@
 
 =head1 GENERATED BY
 
-Catalyst::Helper::Model::DBIC::Schema - 0.30
+Catalyst::Helper::Model::DBIC::Schema - 0.4
 
-=head1 AUTHOR
-
-root
-
 =head1 LICENSE
 
 This library is free software, you can redistribute it and/or modify

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result/Author.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result/Author.pm	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result/Author.pm	2010-02-07 08:59:27 UTC (rev 12817)
@@ -1,12 +1,48 @@
 package MyApp::Schema::Result::Author;
 
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
 use strict;
 use warnings;
 
-use base 'DBIx::Class';
+use base 'DBIx::Class::Core';
 
-__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "Core");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
+
+=head1 NAME
+
+MyApp::Schema::Result::Author
+
+=cut
+
 __PACKAGE__->table("author");
+
+=head1 ACCESSORS
+
+=head2 id
+
+  data_type: INTEGER
+  default_value: undef
+  is_nullable: 1
+  size: undef
+
+=head2 first_name
+
+  data_type: TEXT
+  default_value: undef
+  is_nullable: 1
+  size: undef
+
+=head2 last_name
+
+  data_type: TEXT
+  default_value: undef
+  is_nullable: 1
+  size: undef
+
+=cut
+
 __PACKAGE__->add_columns(
   "id",
   {
@@ -32,24 +68,26 @@
 );
 __PACKAGE__->set_primary_key("id");
 
+=head1 RELATIONS
 
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-11-15 02:47:37
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9lZ2CXUCCy7uvGtVoGK/sA
+=head2 book_authors
 
+Type: has_many
 
-# You can replace this text with custom content, and it will be preserved on regeneration
+Related object: L<MyApp::Schema::Result::BookAuthor>
 
-#
-# Set relationships:
-#
+=cut
 
-# has_many():
-#   args:
-#     1) Name of relationship, DBIC will create an accessor with this name
-#     2) Name of the model class referenced by this relationship
-#     3) Column name in *foreign* table (aka, foreign key in peer table)
-__PACKAGE__->has_many(book_authors => 'MyApp::Schema::Result::BookAuthor', 'author_id');
+__PACKAGE__->has_many(
+  "book_authors",
+  "MyApp::Schema::Result::BookAuthor",
+  { "foreign.author_id" => "self.id" },
+);
 
+
+# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 03:38:55
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kScYKPCfsvhOKRNoVRxKXQ
+
 # many_to_many():
 #   args:
 #     1) Name of relationship, DBIC will create accessor with this name
@@ -58,7 +96,6 @@
 #   You must already have the has_many() defined to use a many_to_many().
 __PACKAGE__->many_to_many(books => 'book_authors', 'book');
 
-
 #
 # Helper methods
 #
@@ -68,4 +105,5 @@
     return $self->first_name . ' ' . $self->last_name;
 }
 
+# You can replace this text with custom content, and it will be preserved on regeneration
 1;

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result/Book.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result/Book.pm	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result/Book.pm	2010-02-07 08:59:27 UTC (rev 12817)
@@ -1,12 +1,62 @@
 package MyApp::Schema::Result::Book;
 
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
 use strict;
 use warnings;
 
-use base 'DBIx::Class';
+use base 'DBIx::Class::Core';
 
-__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "Core");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
+
+=head1 NAME
+
+MyApp::Schema::Result::Book
+
+=cut
+
 __PACKAGE__->table("book");
+
+=head1 ACCESSORS
+
+=head2 id
+
+  data_type: INTEGER
+  default_value: undef
+  is_nullable: 1
+  size: undef
+
+=head2 title
+
+  data_type: TEXT
+  default_value: undef
+  is_nullable: 1
+  size: undef
+
+=head2 rating
+
+  data_type: INTEGER
+  default_value: undef
+  is_nullable: 1
+  size: undef
+
+=head2 created
+
+  data_type: INTEGER
+  default_value: undef
+  is_nullable: 1
+  size: undef
+
+=head2 updated
+
+  data_type: INTEGER
+  default_value: undef
+  is_nullable: 1
+  size: undef
+
+=cut
+
 __PACKAGE__->add_columns(
   "id",
   {
@@ -46,32 +96,25 @@
 );
 __PACKAGE__->set_primary_key("id");
 
+=head1 RELATIONS
 
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-11-15 02:47:37
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5PXol0dYxrGyLSztPv0AAg
+=head2 book_authors
 
+Type: has_many
 
-# You can replace this text with custom content, and it will be preserved on regeneration
+Related object: L<MyApp::Schema::Result::BookAuthor>
 
-#
-# Set relationships:
-#
+=cut
 
-# has_many():
-#   args:
-#     1) Name of relationship, DBIC will create accessor with this name
-#     2) Name of the model class referenced by this relationship
-#     3) Column name in *foreign* table (aka, foreign key in peer table)
-__PACKAGE__->has_many(book_authors => 'MyApp::Schema::Result::BookAuthor', 'book_id');
+__PACKAGE__->has_many(
+  "book_authors",
+  "MyApp::Schema::Result::BookAuthor",
+  { "foreign.book_id" => "self.id" },
+);
 
-# many_to_many():
-#   args:
-#     1) Name of relationship, DBIC will create accessor with this name
-#     2) Name of has_many() relationship this many_to_many() is shortcut for
-#     3) Name of belongs_to() relationship in model class of has_many() above
-#   You must already have the has_many() defined to use a many_to_many().
-__PACKAGE__->many_to_many(authors => 'book_authors', 'author');
 
+# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 03:38:55
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:U19usN8jU9tqBI05jVap/A
 
 #
 # Enable automatic date handling
@@ -83,13 +126,14 @@
     { data_type => 'datetime', set_on_create => 1, set_on_update => 1 },
 );
 
+# many_to_many():
+#   args:
+#     1) Name of relationship, DBIC will create accessor with this name
+#     2) Name of has_many() relationship this many_to_many() is shortcut for
+#     3) Name of belongs_to() relationship in model class of has_many() above
+#   You must already have the has_many() defined to use a many_to_many().
+__PACKAGE__->many_to_many(authors => 'book_authors', 'author');
 
-#
-# Set ResultSet Class
-#
-__PACKAGE__->resultset_class('MyApp::Schema::ResultSet::Book');
-
-
 =head2 author_count
 
 Return the number of authors for the current book
@@ -104,7 +148,6 @@
     return $self->authors->count;
 }
 
-
 =head2 author_list
 
 Return a comma-separated list of authors for the current book
@@ -124,5 +167,5 @@
     return join(', ', @names);
 }
 
-
+# You can replace this text with custom content, and it will be preserved on regeneration
 1;

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm	2010-02-07 08:59:27 UTC (rev 12817)
@@ -1,17 +1,49 @@
 package MyApp::Schema::Result::BookAuthor;
 
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
 use strict;
 use warnings;
 
-use base 'DBIx::Class';
+use base 'DBIx::Class::Core';
 
-__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "Core");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp");
+
+=head1 NAME
+
+MyApp::Schema::Result::BookAuthor
+
+=cut
+
 __PACKAGE__->table("book_author");
+
+=head1 ACCESSORS
+
+=head2 book_id
+
+  data_type: INTEGER
+  default_value: undef
+  is_foreign_key: 1
+  is_nullable: 1
+  size: undef
+
+=head2 author_id
+
+  data_type: INTEGER
+  default_value: undef
+  is_foreign_key: 1
+  is_nullable: 1
+  size: undef
+
+=cut
+
 __PACKAGE__->add_columns(
   "book_id",
   {
     data_type => "INTEGER",
     default_value => undef,
+    is_foreign_key => 1,
     is_nullable => 1,
     size => undef,
   },
@@ -19,35 +51,49 @@
   {
     data_type => "INTEGER",
     default_value => undef,
+    is_foreign_key => 1,
     is_nullable => 1,
     size => undef,
   },
 );
 __PACKAGE__->set_primary_key("book_id", "author_id");
 
+=head1 RELATIONS
 
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-11-15 02:47:37
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:WAZ9QMKajYvXUhiRizk5vA
+=head2 book
 
+Type: belongs_to
 
-# You can replace this text with custom content, and it will be preserved on regeneration
+Related object: L<MyApp::Schema::Result::Book>
 
-#
-# Set relationships:
-#
+=cut
 
-# belongs_to():
-#   args:
-#     1) Name of relationship, DBIC will create accessor with this name
-#     2) Name of the model class referenced by this relationship
-#     3) Column name in *this* table
-__PACKAGE__->belongs_to(book => 'MyApp::Schema::Result::Book', 'book_id');
+__PACKAGE__->belongs_to(
+  "book",
+  "MyApp::Schema::Result::Book",
+  { id => "book_id" },
+  { join_type => "LEFT" },
+);
 
-# belongs_to():
-#   args:
-#     1) Name of relationship, DBIC will create accessor with this name
-#     2) Name of the model class referenced by this relationship
-#     3) Column name in *this* table
-__PACKAGE__->belongs_to(author => 'MyApp::Schema::Result::Author', 'author_id');
+=head2 author
 
+Type: belongs_to
+
+Related object: L<MyApp::Schema::Result::Author>
+
+=cut
+
+__PACKAGE__->belongs_to(
+  "author",
+  "MyApp::Schema::Result::Author",
+  { id => "author_id" },
+  { join_type => "LEFT" },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 03:38:55
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9I2Ii1dsRhMdZnmDr9zA2Q
+
+
+# You can replace this text with custom content, and it will be preserved on regeneration
 1;

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema.pm	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema.pm	2010-02-07 08:59:27 UTC (rev 12817)
@@ -1,15 +1,20 @@
 package MyApp::Schema;
 
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
 use strict;
 use warnings;
 
 use base 'DBIx::Class::Schema';
 
-__PACKAGE__->load_namespaces;
+__PACKAGE__->load_namespaces(
+    result_namespace => 'Result',
+);
 
 
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-11-15 02:47:37
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:iQbv2XXIqhLoIRTFi/InYw
+# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 03:38:55
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+asok1riE0WTYfuUVE6bWg
 
 
 # You can replace this text with custom content, and it will be preserved on regeneration

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/View/TT.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/View/TT.pm	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/View/TT.pm	2010-02-07 08:59:27 UTC (rev 12817)
@@ -7,7 +7,7 @@
 
 __PACKAGE__->config(
     # Change default TT extension
-    TEMPLATE_EXTENSION => '.tt2',
+    #TEMPLATE_EXTENSION => '.tt2',
     # Set the location for TT files
     INCLUDE_PATH => [
             MyApp->path_to( 'root', 'src' ),
@@ -30,10 +30,6 @@
 
 L<MyApp>
 
-=head1 AUTHOR
-
-root
-
 =head1 LICENSE
 
 This library is free software. You can redistribute it and/or modify

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp.pm	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp.pm	2010-02-07 08:59:27 UTC (rev 12817)
@@ -1,8 +1,7 @@
 package MyApp;
+use Moose;
+use namespace::autoclean;
 
-use strict;
-use warnings;
-
 use Catalyst::Runtime 5.80;
 
 # Set flags and add plugins for the application
@@ -13,16 +12,18 @@
 # Static::Simple: will serve static files from the application's root
 #                 directory
 
-use parent qw/Catalyst/;
-# Load plugins
 use Catalyst qw/
-                -Debug
-                ConfigLoader
-                Static::Simple
-            
-                StackTrace
-                /;
+    -Debug
+    ConfigLoader
+    Static::Simple
+
+    StackTrace
+/;
+
+extends 'Catalyst';
+
 our $VERSION = '0.01';
+$VERSION = eval $VERSION;
 
 # Configure the application.
 #
@@ -33,7 +34,11 @@
 # with an external configuration file acting as an override for
 # local deployment.
 
-__PACKAGE__->config( name => 'MyApp' );
+__PACKAGE__->config(
+    name => 'MyApp',
+    # Disable deprecated behavior needed by old applications
+    disable_component_resolution_regex_fallback => 1,
+);
 
 # Start the application
 __PACKAGE__->setup();
@@ -55,10 +60,6 @@
 
 L<MyApp::Controller::Root>, L<Catalyst>
 
-=head1 AUTHOR
-
-root
-
 =head1 LICENSE
 
 This library is free software. You can redistribute it and/or modify

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/myapp.conf
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/myapp.conf	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/myapp.conf	2010-02-07 08:59:27 UTC (rev 12817)
@@ -1,3 +1,3 @@
-# rename this file to MyApp.yml and put a ':' in front of 'name' if
+# rename this file to myapp.yml and put a ':' after 'name' if
 # you want to use YAML like in old versions of Catalyst
 name MyApp

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/myapp.db
===================================================================
(Binary files differ)

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/myapp01.sql
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/myapp01.sql	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/myapp01.sql	2010-02-07 08:59:27 UTC (rev 12817)
@@ -1,3 +1,4 @@
+PRAGMA foreign_keys = ON;
 --
 -- Create a very simple database to hold book and author information
 --
@@ -8,8 +9,8 @@
 );
 -- 'book_author' is a many-to-many join table between books & authors
 CREATE TABLE book_author (
-        book_id     INTEGER,
-        author_id   INTEGER,
+        book_id     INTEGER REFERENCES book(id) ON DELETE CASCADE ON UPDATE CASCADE,
+        author_id   INTEGER REFERENCES author(id) ON DELETE CASCADE ON UPDATE CASCADE,
         PRIMARY KEY (book_id, author_id)
 );
 CREATE TABLE author (
@@ -41,4 +42,3 @@
 INSERT INTO book_author VALUES (4, 6);
 INSERT INTO book_author VALUES (4, 7);
 INSERT INTO book_author VALUES (5, 8);
-

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/root/src/wrapper.tt2
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/root/src/wrapper.tt2	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/root/src/wrapper.tt2	2010-02-07 08:59:27 UTC (rev 12817)
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
 <title>[% template.title or "My Catalyst App!" %]</title>
 <link rel="stylesheet" href="[% c.uri_for('/static/css/main.css') %]" />
@@ -26,7 +26,7 @@
 
 <div id="content">
     [%# Status and error messages %]
-    <span class="message">[% status_msg || c.request.params.status_msg %]</span>
+    <span class="message">[% status_msg %]</span>
     <span class="error">[% error_msg %]</span>
     [%# This is where TT will stick all of your template's contents. -%]
     [% content %]

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/root/static/css/main.css
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/root/static/css/main.css	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/root/static/css/main.css	2010-02-07 08:59:27 UTC (rev 12817)
@@ -34,4 +34,3 @@
 .error {
     color: #f00;
 }
-

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/01app.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/01app.t	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/01app.t	2010-02-07 08:59:27 UTC (rev 12817)
@@ -1,8 +1,10 @@
 #!/usr/bin/env perl
 use strict;
 use warnings;
-use Test::More tests => 2;
+use Test::More;
 
 BEGIN { use_ok 'Catalyst::Test', 'MyApp' }
 
 ok( request('/')->is_success, 'Request should succeed' );
+
+done_testing();

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/controller_Books.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/controller_Books.t	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/controller_Books.t	2010-02-07 08:59:27 UTC (rev 12817)
@@ -1,10 +1,9 @@
 use strict;
 use warnings;
-use Test::More tests => 3;
+use Test::More;
 
 BEGIN { use_ok 'Catalyst::Test', 'MyApp' }
 BEGIN { use_ok 'MyApp::Controller::Books' }
 
 ok( request('/books')->is_success, 'Request should succeed' );
-
-
+done_testing();

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/model_DB.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/model_DB.t	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/model_DB.t	2010-02-07 08:59:27 UTC (rev 12817)
@@ -1,6 +1,7 @@
 use strict;
 use warnings;
-use Test::More tests => 1;
+use Test::More;
 
 BEGIN { use_ok 'MyApp::Model::DB' }
 
+done_testing();

Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/view_TT.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/view_TT.t	2010-02-07 08:11:47 UTC (rev 12816)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/view_TT.t	2010-02-07 08:59:27 UTC (rev 12817)
@@ -1,6 +1,7 @@
 use strict;
 use warnings;
-use Test::More tests => 1;
+use Test::More;
 
 BEGIN { use_ok 'MyApp::View::TT' }
 
+done_testing();




More information about the Catalyst-commits mailing list