[Catalyst-commits] r12933 - in trunk/examples/Tutorial:
Hello_Chapter2/Hello Hello_Chapter2/Hello/lib
Hello_Chapter2/Hello/lib/Hello/Controller
Hello_Chapter2/Hello/lib/Hello/View Hello_Chapter2/Hello/root
Hello_Chapter2/Hello/root/site MyApp_Chapter3/MyApp
MyApp_Chapter3/MyApp/lib MyApp_Chapter3/MyApp/lib/MyApp
MyApp_Chapter3/MyApp/lib/MyApp/Controller
MyApp_Chapter3/MyApp/lib/MyApp/Model
MyApp_Chapter3/MyApp/lib/MyApp/Schema/Result
MyApp_Chapter3/MyApp/lib/MyApp/View MyApp_Chapter3/MyApp/root/src
MyApp_Chapter3/MyApp/root/static/css MyApp_Chapter3/MyApp/t
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/Schema/ResultSet
MyApp_Chapter4/MyApp/lib/MyApp/View MyApp_Chapter4/MyApp/root/src
MyApp_Chapter4/MyApp/root/static/css MyApp_Chapter4/MyApp/t
MyApp_Chapter5/MyApp MyApp_Chapter5/MyApp/lib
MyApp_Chapter5/MyApp/lib/MyApp
MyApp_Chapter5/MyApp/lib/MyApp/Controller
MyApp_Chapter5/MyApp/lib/MyApp/Model
MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result
MyApp_Chapter5/MyApp/lib/MyApp/Schema/ResultSet
MyApp_Chapter5/MyApp/lib/MyApp/View MyApp_Chapter5/MyApp/root/src
MyApp_Chapter5/MyApp/root/static/css MyApp_Chapter5/MyApp/t
MyApp_Chapter6/MyApp MyApp_Chapter6/MyApp/lib
MyApp_Chapter6/MyApp/lib/MyApp
MyApp_Chapter6/MyApp/lib/MyApp/Controller
MyApp_Chapter6/MyApp/lib/MyApp/Model
MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result
MyApp_Chapter6/MyApp/lib/MyApp/Schema/ResultSet
MyApp_Chapter6/MyApp/lib/MyApp/View MyApp_Chapter6/MyApp/root/src
MyApp_Chapter6/MyApp/root/static/css MyApp_Chapter6/MyApp/t
MyApp_Chapter7/MyApp MyApp_Chapter7/MyApp/lib
MyApp_Chapter7/MyApp/lib/MyApp
MyApp_Chapter7/MyApp/lib/MyApp/Controller
MyApp_Chapter7/MyApp/lib/MyApp/Model
MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result
MyApp_Chapter7/MyApp/lib/MyApp/Schema/ResultSet
MyApp_Chapter7/MyApp/lib/MyApp/View MyApp_Chapter7/MyApp/root/src
MyApp_Chapter7/MyApp/root/static/css MyApp_Chapter7/MyApp/t
MyApp_Chapter8/MyApp MyApp_Chapter8/MyApp/lib
MyApp_Chapter8/MyApp/lib/MyApp
MyApp_Chapter8/MyApp/lib/MyApp/Controller
MyApp_Chapter8/MyApp/lib/MyApp/Model
MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result
MyApp_Chapter8/MyApp/lib/MyApp/Schema/ResultSet
MyApp_Chapter8/MyApp/lib/MyApp/View MyApp_Chapter8/MyApp/root/src
MyApp_Chapter8/MyApp/root/static/css MyApp_Chapter8/MyApp/t
MyApp_Chapter9_FormFu/MyApp MyApp_Chapter9_FormFu/MyApp/lib
MyApp_Chapter9_FormFu/MyApp/lib/MyApp
MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller
MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Model
MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result
MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/ResultSet
MyApp_Chapter9_FormFu/MyApp/lib/MyApp/View
MyApp_Chapter9_FormFu/MyApp/root/src
MyApp_Chapter9_FormFu/MyApp/root/src/books
MyApp_Chapter9_FormFu/MyApp/root/static/css
MyApp_Chapter9_FormFu/MyApp/t
hkclark at dev.catalyst.perl.org
hkclark at dev.catalyst.perl.org
Wed Feb 17 20:09:22 GMT 2010
Author: hkclark
Date: 2010-02-17 20:09:20 +0000 (Wed, 17 Feb 2010)
New Revision: 12933
Modified:
trunk/examples/Tutorial/Hello_Chapter2/Hello/Changes
trunk/examples/Tutorial/Hello_Chapter2/Hello/Makefile.PL
trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello.pm
trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Root.pm
trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Site.pm
trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/View/TT.pm
trunk/examples/Tutorial/Hello_Chapter2/Hello/root/hello.tt
trunk/examples/Tutorial/Hello_Chapter2/Hello/root/site/test.tt
trunk/examples/Tutorial/MyApp_Chapter3/MyApp/Changes
trunk/examples/Tutorial/MyApp_Chapter3/MyApp/Makefile.PL
trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp.pm
trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Controller/Books.pm
trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Controller/Root.pm
trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Model/DB.pm
trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Schema.pm
trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Schema/Result/Author.pm
trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Schema/Result/Book.pm
trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm
trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/View/TT.pm
trunk/examples/Tutorial/MyApp_Chapter3/MyApp/myapp01.sql
trunk/examples/Tutorial/MyApp_Chapter3/MyApp/root/src/wrapper.tt2
trunk/examples/Tutorial/MyApp_Chapter3/MyApp/root/static/css/main.css
trunk/examples/Tutorial/MyApp_Chapter3/MyApp/t/view_TT.t
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/Schema/ResultSet/Book.pm
trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/View/TT.pm
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/view_TT.t
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/Changes
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/Makefile.PL
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp.pm
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Books.pm
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Login.pm
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Logout.pm
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Root.pm
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Model/DB.pm
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema.pm
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/Author.pm
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/Book.pm
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/Role.pm
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/User.pm
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/UserRole.pm
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/ResultSet/Book.pm
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/View/TT.pm
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/myapp.db
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/myapp01.sql
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/myapp02.sql
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/root/src/wrapper.tt2
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/root/static/css/main.css
trunk/examples/Tutorial/MyApp_Chapter5/MyApp/t/view_TT.t
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/Changes
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/Makefile.PL
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp.pm
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Books.pm
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Login.pm
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Logout.pm
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Root.pm
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Model/DB.pm
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema.pm
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/Author.pm
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/Book.pm
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/Role.pm
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/User.pm
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/UserRole.pm
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/ResultSet/Book.pm
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/View/TT.pm
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/myapp.db
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/myapp01.sql
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/myapp02.sql
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/root/src/wrapper.tt2
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/root/static/css/main.css
trunk/examples/Tutorial/MyApp_Chapter6/MyApp/t/view_TT.t
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/Changes
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/Makefile.PL
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp.pm
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Books.pm
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Login.pm
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Logout.pm
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Root.pm
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Model/DB.pm
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema.pm
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Author.pm
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Book.pm
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Role.pm
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/User.pm
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/UserRole.pm
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/ResultSet/Book.pm
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/View/TT.pm
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/myapp.db
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/myapp01.sql
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/myapp02.sql
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/root/src/wrapper.tt2
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/root/static/css/main.css
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/view_TT.t
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/Changes
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/Makefile.PL
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp.pm
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Books.pm
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Login.pm
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Logout.pm
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Root.pm
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Model/DB.pm
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema.pm
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/Author.pm
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/Book.pm
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/Role.pm
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/User.pm
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/UserRole.pm
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/ResultSet/Book.pm
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/View/TT.pm
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/myapp.db
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/myapp01.sql
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/myapp02.sql
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/myappTEST.db
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/root/src/wrapper.tt2
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/root/static/css/main.css
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/controller_Books.t
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/controller_Logout.t
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/live_app01.t
trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/view_TT.t
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/Changes
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/Makefile.PL
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp.pm
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Books.pm
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Login.pm
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Logout.pm
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Root.pm
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Model/DB.pm
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema.pm
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/Author.pm
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/Book.pm
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/Role.pm
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/User.pm
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/UserRole.pm
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/ResultSet/Book.pm
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/View/TT.pm
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/myapp.db
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/myapp01.sql
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/myapp02.sql
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/myappTEST.db
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/root/src/books/formfu_create.tt2
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/root/src/wrapper.tt2
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/root/static/css/main.css
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/controller_Books.t
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/controller_Logout.t
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/live_app01.t
trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/view_TT.t
Log:
Update example files for each chapter to match the 5.8004 release for Catalyst::Manual
Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/Changes
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/Changes 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/Changes 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,4 +1,4 @@
This file documents the revision history for Perl extension Hello.
-0.01 2010-02-07 02:21:04
+0.01 2010-02-17 15:01:31
- initial revision, generated by Catalyst
Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/Makefile.PL
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/Makefile.PL 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/Makefile.PL 2010-02-17 20:09:20 UTC (rev 12933)
@@ -6,7 +6,7 @@
name 'Hello';
all_from 'lib/Hello.pm';
-requires 'Catalyst::Runtime' => '5.80018';
+requires 'Catalyst::Runtime' => '5.8002';
requires 'Catalyst::Plugin::ConfigLoader';
requires 'Catalyst::Plugin::Static::Simple';
requires 'Catalyst::Action::RenderView';
Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Root.pm
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Root.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Root.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -14,6 +14,10 @@
Hello::Controller::Root - Root Controller for Hello
+=head1 DESCRIPTION
+
+[enter your description here]
+
=head1 METHODS
=head2 index
@@ -29,12 +33,6 @@
$c->response->body( $c->welcome_message );
}
-sub hello :Global {
- my ( $self, $c ) = @_;
-
- $c->stash(template => 'hello.tt');
-}
-
=head2 default
Standard 404 error page
@@ -55,6 +53,18 @@
sub end : ActionClass('RenderView') {}
+
+sub hello :Global {
+ my ( $self, $c ) = @_;
+
+ $c->stash(template => 'hello.tt');
+}
+
+
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Site.pm
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Site.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/Controller/Site.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
=cut
@@ -26,13 +27,19 @@
$c->response->body('Matched Hello::Controller::Site in Site.');
}
+
sub test :Local {
my ( $self, $c ) = @_;
- $c->stash->{username} = "John";
- $c->stash->{template} = 'site/test.tt';
+ $c->stash(username => 'John',
+ template => 'site/test.tt');
}
+
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
@@ -42,4 +49,3 @@
__PACKAGE__->meta->make_immutable;
-1;
Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/View/TT.pm
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/View/TT.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello/View/TT.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -19,6 +19,10 @@
L<Hello>
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello.pm
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/lib/Hello.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -58,6 +58,10 @@
L<Hello::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/Hello_Chapter2/Hello/root/hello.tt
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/root/hello.tt 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/root/hello.tt 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,3 +1,3 @@
<p>
- This is a TT view template, called '[% template.name %]'.
+ This is a TT view template, called '[% template.name %]'.
</p>
Modified: trunk/examples/Tutorial/Hello_Chapter2/Hello/root/site/test.tt
===================================================================
--- trunk/examples/Tutorial/Hello_Chapter2/Hello/root/site/test.tt 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/Hello_Chapter2/Hello/root/site/test.tt 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,4 +1 @@
<p>Hello, [% username %]!</p>
-<p>
- This is a TT view template, called '[% template.name %]'.
-</p>
Modified: trunk/examples/Tutorial/MyApp_Chapter3/MyApp/Changes
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter3/MyApp/Changes 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/Changes 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,4 +1,4 @@
This file documents the revision history for Perl extension MyApp.
-0.01 2010-02-07 02:42:25
+0.01 2010-02-17 15:23:50
- initial revision, generated by Catalyst
Modified: trunk/examples/Tutorial/MyApp_Chapter3/MyApp/Makefile.PL
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter3/MyApp/Makefile.PL 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/Makefile.PL 2010-02-17 20:09:20 UTC (rev 12933)
@@ -6,10 +6,9 @@
name 'MyApp';
all_from 'lib/MyApp.pm';
-requires 'Catalyst::Runtime' => '5.80018';
+requires 'Catalyst::Runtime' => '5.8002';
requires 'Catalyst::Plugin::ConfigLoader';
requires 'Catalyst::Plugin::Static::Simple';
-requires 'Catalyst::Plugin::StackTrace';
requires 'Catalyst::Action::RenderView';
requires 'Moose';
requires 'namespace::autoclean';
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-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Controller/Books.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
=cut
@@ -26,21 +27,22 @@
$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
-sub list : Local {
+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];
+ # 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
@@ -48,6 +50,11 @@
$c->stash(template => 'books/list.tt2');
}
+
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
@@ -57,4 +64,3 @@
__PACKAGE__->meta->make_immutable;
-1;
Modified: trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Controller/Root.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Controller/Root.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Controller/Root.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -53,6 +53,10 @@
sub end : ActionClass('RenderView') {}
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Model/DB.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Model/DB.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Model/DB.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -30,6 +30,10 @@
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_Chapter3/MyApp/lib/MyApp/Schema/Result/Author.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Schema/Result/Author.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Schema/Result/Author.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -85,9 +85,12 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-02-07 02:51:06
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Vhj6UVheVw3mzDb/aisBAg
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 15:29:27
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+Gkx86tK+2e5HUpa01M+2g
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
# many_to_many():
# args:
# 1) Name of relationship, DBIC will create accessor with this name
@@ -96,5 +99,4 @@
# You must already have the has_many() defined to use a many_to_many().
__PACKAGE__->many_to_many(books => 'book_authors', 'book');
-# You can replace this text with custom content, and it will be preserved on regeneration
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Schema/Result/Book.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Schema/Result/Book.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Schema/Result/Book.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -85,9 +85,12 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-02-07 02:51:06
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:IELkSZRwIMnh5CfAPiCz6g
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 15:29:27
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sKB+LZSGQzhTqj1zzO8q/w
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
# many_to_many():
# args:
# 1) Name of relationship, DBIC will create accessor with this name
@@ -96,5 +99,4 @@
# You must already have the has_many() defined to use a many_to_many().
__PACKAGE__->many_to_many(authors => 'book_authors', 'author');
-# You can replace this text with custom content, and it will be preserved on regeneration
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -91,8 +91,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05000 @ 2010-02-07 02:51:06
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Diq+kS1Tl4ze/8uNXIYowQ
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 15:29:27
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:LgHjqbiDg4QDgx4gGhJxMQ
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Schema.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Schema.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/Schema.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -8,13 +8,11 @@
use base 'DBIx::Class::Schema';
-__PACKAGE__->load_namespaces(
- result_namespace => 'Result',
-);
+__PACKAGE__->load_namespaces;
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 03:08:05
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:8RFCrYpX8XplI+2rG0nYXg
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 15:29:27
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1k0GfzGX/McG/tJ0TnITjw
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/View/TT.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/View/TT.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp/View/TT.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -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,6 +30,10 @@
L<MyApp>
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/lib/MyApp.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -12,6 +12,7 @@
# Static::Simple: will serve static files from the application's root
# directory
+# Load plugins
use Catalyst qw/
-Debug
ConfigLoader
@@ -60,6 +61,10 @@
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_Chapter3/MyApp/myapp01.sql
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter3/MyApp/myapp01.sql 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/myapp01.sql 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,7 +1,7 @@
-PRAGMA foreign_keys = ON;
--
-- Create a very simple database to hold book and author information
--
+PRAGMA foreign_keys = ON;
CREATE TABLE book (
id INTEGER PRIMARY KEY,
title TEXT ,
@@ -42,3 +42,4 @@
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_Chapter3/MyApp/root/src/wrapper.tt2
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter3/MyApp/root/src/wrapper.tt2 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/root/src/wrapper.tt2 2010-02-17 20:09:20 UTC (rev 12933)
@@ -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') %]" />
Modified: trunk/examples/Tutorial/MyApp_Chapter3/MyApp/root/static/css/main.css
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter3/MyApp/root/static/css/main.css 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/root/static/css/main.css 2010-02-17 20:09:20 UTC (rev 12933)
@@ -34,3 +34,4 @@
.error {
color: #f00;
}
+
Modified: trunk/examples/Tutorial/MyApp_Chapter3/MyApp/t/view_TT.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter3/MyApp/t/view_TT.t 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter3/MyApp/t/view_TT.t 2010-02-17 20:09:20 UTC (rev 12933)
@@ -2,6 +2,6 @@
use warnings;
use Test::More;
-BEGIN { use_ok 'MyApp', 'MyApp::View::TT' }
+BEGIN { use_ok 'MyApp::View::TT' }
done_testing();
Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/Changes
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/Changes 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/Changes 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,4 +1,4 @@
This file documents the revision history for Perl extension MyApp.
-0.01 2010-02-07 02:42:25
+0.01 2010-02-17 15:23:50
- initial revision, generated by Catalyst
Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/Makefile.PL
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/Makefile.PL 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/Makefile.PL 2010-02-17 20:09:20 UTC (rev 12933)
@@ -6,10 +6,9 @@
name 'MyApp';
all_from 'lib/MyApp.pm';
-requires 'Catalyst::Runtime' => '5.80018';
+requires 'Catalyst::Runtime' => '5.8002';
requires 'Catalyst::Plugin::ConfigLoader';
requires 'Catalyst::Plugin::Static::Simple';
-requires 'Catalyst::Plugin::StackTrace';
requires 'Catalyst::Action::RenderView';
requires 'Moose';
requires 'namespace::autoclean';
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-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Controller/Books.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
=cut
@@ -26,21 +27,22 @@
$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
-sub list : Local {
+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];
+ # 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
@@ -48,6 +50,7 @@
$c->stash(template => 'books/list.tt2');
}
+
=head2 base
Can place common logic to start chained dispatch here
@@ -58,7 +61,7 @@
my ($self, $c) = @_;
# Store the ResultSet in stash so it's available for other methods
- $c->stash->{resultset} = $c->model('DB::Book');
+ $c->stash(resultset => $c->model('DB::Book'));
# Print a message to the debug log
$c->log->debug('*** INSIDE BASE METHOD ***');
@@ -71,7 +74,7 @@
=cut
-sub url_create :Chained('base') :PathPart('url_create') :Args(3) {
+sub url_create :Chained('/') :PathPart('books/url_create') :Args(3) {
# In addition to self & context, get the title, rating, &
# author_id args from the URL. Note that Catalyst automatically
# puts the first 3 arguments worth of extra information after the
@@ -92,11 +95,9 @@
# 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 for display and set template
+ $c->stash(book => $book,
+ template => 'books/create_done.tt2');
}
@@ -110,16 +111,16 @@
my ($self, $c) = @_;
# Set the TT template to use
- $c->stash->{template} = 'books/form_create.tt2';
+ $c->stash(template => 'books/form_create.tt2');
}
=head2 form_create_do
-
+
Take information from form and add to database
-
+
=cut
-
+
sub form_create_do :Chained('base') :PathPart('form_create_do') :Args(0) {
my ($self, $c) = @_;
@@ -138,18 +139,15 @@
# Note: Above is a shortcut for this:
# $book->create_related('book_authors', {author_id => $author_id});
- # Store new model object in stash
- $c->stash->{book} = $book;
-
# Avoid Data::Dumper issue mentioned earlier
# You can probably omit this
$Data::Dumper::Useperl = 1;
- # Set the TT template to use
- $c->stash->{template} = 'books/create_done.tt2';
+ # Store new model object in stash and set template
+ $c->stash(book => $book,
+ template => 'books/create_done.tt2');
}
-
=head2 object
Fetch the specified book object based on the book ID and store
@@ -205,13 +203,13 @@
# Retrieve all of the book records as book model objects and store in the
# stash where they can be accessed by the TT template, but only
# retrieve books created within the last $min number of minutes
- $c->stash->{books} = [$c->model('DB::Book')
- ->created_after(DateTime->now->subtract(minutes => $mins))];
+ $c->stash(books => [$c->model('DB::Book')
+ ->created_after(DateTime->now->subtract(minutes => $mins))]);
# 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');
}
@@ -228,17 +226,22 @@
# stash where they can be accessed by the TT template, but only
# retrieve books created within the last $min number of minutes
# AND that have 'TCP' in the title
- $c->stash->{books} = [$c->model('DB::Book')
+ $c->stash(books => [$c->model('DB::Book')
->created_after(DateTime->now->subtract(minutes => $mins))
->title_like('TCP')
- ];
+ ]);
# 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 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
@@ -248,4 +251,3 @@
__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-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Controller/Root.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -53,6 +53,10 @@
sub end : ActionClass('RenderView') {}
+=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/Model/DB.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Model/DB.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Model/DB.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -30,6 +30,10 @@
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-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result/Author.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -85,9 +85,12 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 03:38:55
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:kScYKPCfsvhOKRNoVRxKXQ
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:11:03
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:7XS2uaOlhT4yszzBcno9LA
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
# many_to_many():
# args:
# 1) Name of relationship, DBIC will create accessor with this name
@@ -96,8 +99,9 @@
# You must already have the has_many() defined to use a many_to_many().
__PACKAGE__->many_to_many(books => 'book_authors', 'book');
+
#
-# Helper methods
+# Row-level helper methods
#
sub full_name {
my ($self) = @_;
@@ -105,5 +109,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-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result/Book.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -113,9 +113,21 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 03:38:55
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:U19usN8jU9tqBI05jVap/A
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:11:03
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2NsjIEysgPmCPAMoZGsK7g
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
+# 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');
+
+
#
# Enable automatic date handling
#
@@ -126,13 +138,6 @@
{ 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');
=head2 author_count
@@ -148,6 +153,7 @@
return $self->authors->count;
}
+
=head2 author_list
Return a comma-separated list of authors for the current book
@@ -167,5 +173,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-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -91,8 +91,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 03:38:55
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9I2Ii1dsRhMdZnmDr9zA2Q
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:11:03
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:N9Wcg3V5LY87iRd02lD9CQ
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/ResultSet/Book.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/ResultSet/Book.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema/ResultSet/Book.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -36,6 +36,5 @@
});
}
-
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/Schema.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -13,8 +13,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 03:38:55
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+asok1riE0WTYfuUVE6bWg
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:11:03
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:j5kySHBu9x4UICiATq/+Uw
# 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-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp/View/TT.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -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,6 +30,10 @@
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-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/lib/MyApp.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -12,6 +12,7 @@
# Static::Simple: will serve static files from the application's root
# directory
+# Load plugins
use Catalyst qw/
-Debug
ConfigLoader
@@ -60,6 +61,10 @@
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.db
===================================================================
(Binary files differ)
Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/myapp01.sql
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/myapp01.sql 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/myapp01.sql 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,7 +1,7 @@
-PRAGMA foreign_keys = ON;
--
-- Create a very simple database to hold book and author information
--
+PRAGMA foreign_keys = ON;
CREATE TABLE book (
id INTEGER PRIMARY KEY,
title TEXT ,
@@ -42,3 +42,4 @@
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-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/root/src/wrapper.tt2 2010-02-17 20:09:20 UTC (rev 12933)
@@ -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') %]" />
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-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/root/static/css/main.css 2010-02-17 20:09:20 UTC (rev 12933)
@@ -34,3 +34,4 @@
.error {
color: #f00;
}
+
Modified: trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/view_TT.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/view_TT.t 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter4/MyApp/t/view_TT.t 2010-02-17 20:09:20 UTC (rev 12933)
@@ -2,6 +2,6 @@
use warnings;
use Test::More;
-BEGIN { use_ok 'MyApp', 'MyApp::View::TT' }
+BEGIN { use_ok 'MyApp::View::TT' }
done_testing();
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/Changes
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/Changes 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/Changes 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,4 +1,4 @@
This file documents the revision history for Perl extension MyApp.
-0.01 2010-02-07 02:42:25
+0.01 2010-02-17 15:23:50
- initial revision, generated by Catalyst
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/Makefile.PL
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/Makefile.PL 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/Makefile.PL 2010-02-17 20:09:20 UTC (rev 12933)
@@ -6,19 +6,18 @@
name 'MyApp';
all_from 'lib/MyApp.pm';
-requires 'Catalyst::Runtime' => '5.80018';
+requires 'Catalyst::Runtime' => '5.8002';
requires 'Catalyst::Plugin::ConfigLoader';
requires 'Catalyst::Plugin::Static::Simple';
-requires 'Catalyst::Plugin::StackTrace';
-requires 'Catalyst::Plugin::Authentication';
-requires 'Catalyst::Plugin::Session';
-requires 'Catalyst::Plugin::Session::Store::FastMmap';
-requires 'Catalyst::Plugin::Session::State::Cookie';
requires 'Catalyst::Action::RenderView';
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
+requires 'Catalyst::Plugin::Authentication';
+requires 'Catalyst::Plugin::Session';
+requires 'Catalyst::Plugin::Session::Store::FastMmap';
+requires 'Catalyst::Plugin::Session::State::Cookie';
test_requires 'Test::More' => '0.88';
catalyst;
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Books.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Books.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Books.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
=cut
@@ -26,21 +27,22 @@
$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
-sub list : Local {
+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];
+ # 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
@@ -48,6 +50,7 @@
$c->stash(template => 'books/list.tt2');
}
+
=head2 base
Can place common logic to start chained dispatch here
@@ -58,7 +61,7 @@
my ($self, $c) = @_;
# Store the ResultSet in stash so it's available for other methods
- $c->stash->{resultset} = $c->model('DB::Book');
+ $c->stash(resultset => $c->model('DB::Book'));
# Print a message to the debug log
$c->log->debug('*** INSIDE BASE METHOD ***');
@@ -71,7 +74,7 @@
=cut
-sub url_create :Chained('base') :PathPart('url_create') :Args(3) {
+sub url_create :Chained('/') :PathPart('books/url_create') :Args(3) {
# In addition to self & context, get the title, rating, &
# author_id args from the URL. Note that Catalyst automatically
# puts the first 3 arguments worth of extra information after the
@@ -92,11 +95,9 @@
# 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 for display and set template
+ $c->stash(book => $book,
+ template => 'books/create_done.tt2');
}
@@ -110,16 +111,16 @@
my ($self, $c) = @_;
# Set the TT template to use
- $c->stash->{template} = 'books/form_create.tt2';
+ $c->stash(template => 'books/form_create.tt2');
}
=head2 form_create_do
-
+
Take information from form and add to database
-
+
=cut
-
+
sub form_create_do :Chained('base') :PathPart('form_create_do') :Args(0) {
my ($self, $c) = @_;
@@ -138,18 +139,15 @@
# Note: Above is a shortcut for this:
# $book->create_related('book_authors', {author_id => $author_id});
- # Store new model object in stash
- $c->stash->{book} = $book;
-
# Avoid Data::Dumper issue mentioned earlier
# You can probably omit this
$Data::Dumper::Useperl = 1;
- # Set the TT template to use
- $c->stash->{template} = 'books/create_done.tt2';
+ # Store new model object in stash and set template
+ $c->stash(book => $book,
+ template => 'books/create_done.tt2');
}
-
=head2 object
Fetch the specified book object based on the book ID and store
@@ -184,7 +182,7 @@
my ($self, $c) = @_;
# Use the book object saved by 'object' and delete it along
- # with related 'book_author' entries
+ # with related 'book_authors' entries
$c->stash->{object}->delete;
# Use 'flash' to save information across requests until it's read
@@ -207,13 +205,13 @@
# Retrieve all of the book records as book model objects and store in the
# stash where they can be accessed by the TT template, but only
# retrieve books created within the last $min number of minutes
- $c->stash->{books} = [$c->model('DB::Book')
- ->created_after(DateTime->now->subtract(minutes => $mins))];
+ $c->stash(books => [$c->model('DB::Book')
+ ->created_after(DateTime->now->subtract(minutes => $mins))]);
# 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');
}
@@ -230,17 +228,22 @@
# stash where they can be accessed by the TT template, but only
# retrieve books created within the last $min number of minutes
# AND that have 'TCP' in the title
- $c->stash->{books} = [$c->model('DB::Book')
+ $c->stash(books => [$c->model('DB::Book')
->created_after(DateTime->now->subtract(minutes => $mins))
->title_like('TCP')
- ];
+ ]);
# 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 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
@@ -250,4 +253,3 @@
__PACKAGE__->meta->make_immutable;
-1;
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Login.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Login.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Login.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
Login logic
@@ -40,17 +41,22 @@
return;
} else {
# Set an error message
- $c->stash->{error_msg} = "Bad username or password.";
+ $c->stash(error_msg => "Bad username or password.");
}
} else {
# Set an error message
- $c->stash->{error_msg} = "Empty username or password.";
+ $c->stash(error_msg => "Empty username or password.");
}
# If either of above don't work out, send to the login page
- $c->stash->{template} = 'login.tt2';
+ $c->stash(template => 'login.tt2');
}
+
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Logout.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Logout.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Logout.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
Logout logic
@@ -32,6 +33,11 @@
$c->response->redirect($c->uri_for('/'));
}
+
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Root.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Root.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Controller/Root.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -20,6 +20,40 @@
=head1 METHODS
+=head2 index
+
+The root page (/)
+
+=cut
+
+sub index :Path :Args(0) {
+ my ( $self, $c ) = @_;
+
+ # Hello World
+ $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' );
+ $c->response->status(404);
+}
+
+=head2 end
+
+Attempt to render a view, if needed.
+
+=cut
+
+sub end : ActionClass('RenderView') {}
+
+
=head2 auto
Check if there is a user and, if not, forward to login page
@@ -29,7 +63,7 @@
# Note that 'auto' runs after 'begin' but before your actions and that
# 'auto's "chain" (all from application path to most specific class are run)
# See the 'Actions' section of 'Catalyst::Manual::Intro' for more info.
-sub auto : Private {
+sub auto :Private {
my ($self, $c) = @_;
# Allow unauthenticated users to reach the login page. This
@@ -56,39 +90,11 @@
return 1;
}
-=head2 index
-The root page (/)
+=head1 AUTHOR
-=cut
+root
-sub index :Path :Args(0) {
- my ( $self, $c ) = @_;
-
- # Hello World
- $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' );
- $c->response->status(404);
-}
-
-=head2 end
-
-Attempt to render a view, if needed.
-
-=cut
-
-sub end : ActionClass('RenderView') {}
-
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Model/DB.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Model/DB.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Model/DB.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -30,6 +30,10 @@
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_Chapter5/MyApp/lib/MyApp/Schema/Result/Author.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/Author.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/Author.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -85,9 +85,12 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oAaQWLwMfVf6x2RUSDDy3w
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zW5eyFeMspfXIYEwR03fmA
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
# many_to_many():
# args:
# 1) Name of relationship, DBIC will create accessor with this name
@@ -96,8 +99,9 @@
# You must already have the has_many() defined to use a many_to_many().
__PACKAGE__->many_to_many(books => 'book_authors', 'book');
+
#
-# Helper methods
+# Row-level helper methods
#
sub full_name {
my ($self) = @_;
@@ -105,5 +109,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_Chapter5/MyApp/lib/MyApp/Schema/Result/Book.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/Book.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/Book.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -113,9 +113,21 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QHvXdV7xNcT3CDXRI/jLjg
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:enqGmdv33Ni7uxKjN30zdQ
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
+# 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');
+
+
#
# Enable automatic date handling
#
@@ -126,13 +138,6 @@
{ 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');
=head2 author_count
@@ -148,6 +153,7 @@
return $self->authors->count;
}
+
=head2 author_list
Return a comma-separated list of authors for the current book
@@ -167,5 +173,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_Chapter5/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -91,8 +91,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ClqpMc0qpOO7W5mt7sjL3w
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZMK0hr6Xt1qblHTYLKo18g
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/Role.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/Role.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/Role.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -71,8 +71,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZM+4fiRxAJxcpem7BzNCJA
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:I2Sm+YHDp9fI2mcsZ2dj8g
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/User.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/User.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/User.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -141,9 +141,12 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xfjg2vo+tmdbYqJjWt93aw
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:174DVpqYH1U4h9EGCBq87Q
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
# many_to_many():
# args:
# 1) Name of relationship, DBIC will create accessor with this name
@@ -152,6 +155,7 @@
# You must already have the has_many() defined to use a many_to_many().
__PACKAGE__->many_to_many(roles => 'user_roles', 'role');
+
# Have the 'password' column use a SHA-1 hash and 10-character salt
# with hex encoding; Generate the 'check_password" method
__PACKAGE__->add_columns(
@@ -165,5 +169,5 @@
},
);
-# You can replace this text with custom content, and it will be preserved on regeneration
+
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/UserRole.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/UserRole.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/Result/UserRole.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -91,8 +91,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tsDMQcH8uEP2vYbVZm6WiA
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bRXps6LBVc4JT2SWbhY0cA
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/ResultSet/Book.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/ResultSet/Book.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema/ResultSet/Book.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -36,6 +36,5 @@
});
}
-
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/Schema.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -13,8 +13,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 03:38:55
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+asok1riE0WTYfuUVE6bWg
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:11:03
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:j5kySHBu9x4UICiATq/+Uw
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/View/TT.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/View/TT.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp/View/TT.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -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,6 +30,10 @@
L<MyApp>
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/lib/MyApp.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -12,6 +12,7 @@
# Static::Simple: will serve static files from the application's root
# directory
+# Load plugins
use Catalyst qw/
-Debug
ConfigLoader
@@ -41,11 +42,11 @@
# local deployment.
__PACKAGE__->config(
- name => 'MyApp',
- # Disable deprecated behavior needed by old applications
- disable_component_resolution_regex_fallback => 1,
- session => { flash_to_stash => 1 },
-);
+ name => 'MyApp',
+ # Disable deprecated behavior needed by old applications
+ disable_component_resolution_regex_fallback => 1,
+ session => { flash_to_stash => 1 },
+ );
# Configure SimpleDB Authentication
__PACKAGE__->config->{'Plugin::Authentication'} = {
@@ -56,6 +57,7 @@
},
};
+
# Start the application
__PACKAGE__->setup();
@@ -76,6 +78,10 @@
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_Chapter5/MyApp/myapp.db
===================================================================
(Binary files differ)
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/myapp01.sql
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/myapp01.sql 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/myapp01.sql 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,7 +1,7 @@
-PRAGMA foreign_keys = ON;
--
-- Create a very simple database to hold book and author information
--
+PRAGMA foreign_keys = ON;
CREATE TABLE book (
id INTEGER PRIMARY KEY,
title TEXT ,
@@ -42,3 +42,4 @@
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_Chapter5/MyApp/myapp02.sql
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/myapp02.sql 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/myapp02.sql 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,7 +1,7 @@
-PRAGMA foreign_keys = ON;
--
-- Add user and role tables, along with a many-to-many join table
--
+PRAGMA foreign_keys = ON;
CREATE TABLE user (
id INTEGER PRIMARY KEY,
username TEXT,
@@ -32,3 +32,4 @@
INSERT INTO user_role VALUES (1, 2);
INSERT INTO user_role VALUES (2, 1);
INSERT INTO user_role VALUES (3, 1);
+
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/root/src/wrapper.tt2
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/root/src/wrapper.tt2 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/root/src/wrapper.tt2 2010-02-17 20:09:20 UTC (rev 12933)
@@ -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') %]" />
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/root/static/css/main.css
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/root/static/css/main.css 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/root/static/css/main.css 2010-02-17 20:09:20 UTC (rev 12933)
@@ -34,3 +34,4 @@
.error {
color: #f00;
}
+
Modified: trunk/examples/Tutorial/MyApp_Chapter5/MyApp/t/view_TT.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter5/MyApp/t/view_TT.t 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter5/MyApp/t/view_TT.t 2010-02-17 20:09:20 UTC (rev 12933)
@@ -2,6 +2,6 @@
use warnings;
use Test::More;
-BEGIN { use_ok 'MyApp', 'MyApp::View::TT' }
+BEGIN { use_ok 'MyApp::View::TT' }
done_testing();
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/Changes
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/Changes 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/Changes 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,4 +1,4 @@
This file documents the revision history for Perl extension MyApp.
-0.01 2010-02-07 02:42:25
+0.01 2010-02-17 15:23:50
- initial revision, generated by Catalyst
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/Makefile.PL
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/Makefile.PL 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/Makefile.PL 2010-02-17 20:09:20 UTC (rev 12933)
@@ -6,20 +6,19 @@
name 'MyApp';
all_from 'lib/MyApp.pm';
-requires 'Catalyst::Runtime' => '5.80018';
+requires 'Catalyst::Runtime' => '5.8002';
requires 'Catalyst::Plugin::ConfigLoader';
requires 'Catalyst::Plugin::Static::Simple';
-requires 'Catalyst::Plugin::StackTrace';
-requires 'Catalyst::Plugin::Authentication';
-requires 'Catalyst::Plugin::Authorization::Roles';
-requires 'Catalyst::Plugin::Session';
-requires 'Catalyst::Plugin::Session::Store::FastMmap';
-requires 'Catalyst::Plugin::Session::State::Cookie';
requires 'Catalyst::Action::RenderView';
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
+requires 'Catalyst::Plugin::Authentication';
+requires 'Catalyst::Plugin::Authorization::Roles';
+requires 'Catalyst::Plugin::Session';
+requires 'Catalyst::Plugin::Session::Store::FastMmap';
+requires 'Catalyst::Plugin::Session::State::Cookie';
test_requires 'Test::More' => '0.88';
catalyst;
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Books.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Books.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Books.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
=cut
@@ -26,21 +27,22 @@
$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
-sub list : Local {
+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];
+ # 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
@@ -48,6 +50,7 @@
$c->stash(template => 'books/list.tt2');
}
+
=head2 base
Can place common logic to start chained dispatch here
@@ -58,7 +61,7 @@
my ($self, $c) = @_;
# Store the ResultSet in stash so it's available for other methods
- $c->stash->{resultset} = $c->model('DB::Book');
+ $c->stash(resultset => $c->model('DB::Book'));
# Print a message to the debug log
$c->log->debug('*** INSIDE BASE METHOD ***');
@@ -93,11 +96,9 @@
# 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!');
@@ -115,16 +116,16 @@
my ($self, $c) = @_;
# Set the TT template to use
- $c->stash->{template} = 'books/form_create.tt2';
+ $c->stash(template => 'books/form_create.tt2');
}
=head2 form_create_do
-
+
Take information from form and add to database
-
+
=cut
-
+
sub form_create_do :Chained('base') :PathPart('form_create_do') :Args(0) {
my ($self, $c) = @_;
@@ -143,18 +144,15 @@
# Note: Above is a shortcut for this:
# $book->create_related('book_authors', {author_id => $author_id});
- # Store new model object in stash
- $c->stash->{book} = $book;
-
# Avoid Data::Dumper issue mentioned earlier
# You can probably omit this
$Data::Dumper::Useperl = 1;
- # Set the TT template to use
- $c->stash->{template} = 'books/create_done.tt2';
+ # Store new model object in stash and set template
+ $c->stash(book => $book,
+ template => 'books/create_done.tt2');
}
-
=head2 object
Fetch the specified book object based on the book ID and store
@@ -193,7 +191,7 @@
unless $c->stash->{object}->delete_allowed_by($c->user->get_object);
# Use the book object saved by 'object' and delete it along
- # with related 'book_author' entries
+ # with related 'book_authors' entries
$c->stash->{object}->delete;
# Use 'flash' to save information across requests until it's read
@@ -216,13 +214,13 @@
# Retrieve all of the book records as book model objects and store in the
# stash where they can be accessed by the TT template, but only
# retrieve books created within the last $min number of minutes
- $c->stash->{books} = [$c->model('DB::Book')
- ->created_after(DateTime->now->subtract(minutes => $mins))];
+ $c->stash(books => [$c->model('DB::Book')
+ ->created_after(DateTime->now->subtract(minutes => $mins))]);
# 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');
}
@@ -239,17 +237,22 @@
# stash where they can be accessed by the TT template, but only
# retrieve books created within the last $min number of minutes
# AND that have 'TCP' in the title
- $c->stash->{books} = [$c->model('DB::Book')
+ $c->stash(books => [$c->model('DB::Book')
->created_after(DateTime->now->subtract(minutes => $mins))
->title_like('TCP')
- ];
+ ]);
# 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 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
@@ -259,4 +262,3 @@
__PACKAGE__->meta->make_immutable;
-1;
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Login.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Login.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Login.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
Login logic
@@ -40,17 +41,22 @@
return;
} else {
# Set an error message
- $c->stash->{error_msg} = "Bad username or password.";
+ $c->stash(error_msg => "Bad username or password.");
}
} else {
# Set an error message
- $c->stash->{error_msg} = "Empty username or password.";
+ $c->stash(error_msg => "Empty username or password.");
}
# If either of above don't work out, send to the login page
- $c->stash->{template} = 'login.tt2';
+ $c->stash(template => 'login.tt2');
}
+
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Logout.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Logout.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Logout.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
Logout logic
@@ -32,6 +33,11 @@
$c->response->redirect($c->uri_for('/'));
}
+
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Root.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Root.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Controller/Root.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -20,6 +20,40 @@
=head1 METHODS
+=head2 index
+
+The root page (/)
+
+=cut
+
+sub index :Path :Args(0) {
+ my ( $self, $c ) = @_;
+
+ # Hello World
+ $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' );
+ $c->response->status(404);
+}
+
+=head2 end
+
+Attempt to render a view, if needed.
+
+=cut
+
+sub end : ActionClass('RenderView') {}
+
+
=head2 auto
Check if there is a user and, if not, forward to login page
@@ -29,7 +63,7 @@
# Note that 'auto' runs after 'begin' but before your actions and that
# 'auto's "chain" (all from application path to most specific class are run)
# See the 'Actions' section of 'Catalyst::Manual::Intro' for more info.
-sub auto : Private {
+sub auto :Private {
my ($self, $c) = @_;
# Allow unauthenticated users to reach the login page. This
@@ -56,31 +90,7 @@
return 1;
}
-=head2 index
-The root page (/)
-
-=cut
-
-sub index :Path :Args(0) {
- my ( $self, $c ) = @_;
-
- # Hello World
- $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' );
- $c->response->status(404);
-}
-
=head2 error_noperms
Permissions error screen
@@ -90,17 +100,14 @@
sub error_noperms :Chained('/') :PathPart('error_noperms') :Args(0) {
my ($self, $c) = @_;
- $c->stash->{template} = 'error_noperms.tt2';
+ $c->stash(template => 'error_noperms.tt2');
}
-=head2 end
-Attempt to render a view, if needed.
+=head1 AUTHOR
-=cut
+root
-sub end : ActionClass('RenderView') {}
-
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Model/DB.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Model/DB.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Model/DB.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -30,6 +30,10 @@
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_Chapter6/MyApp/lib/MyApp/Schema/Result/Author.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/Author.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/Author.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -85,9 +85,12 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oAaQWLwMfVf6x2RUSDDy3w
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zW5eyFeMspfXIYEwR03fmA
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
# many_to_many():
# args:
# 1) Name of relationship, DBIC will create accessor with this name
@@ -96,8 +99,9 @@
# You must already have the has_many() defined to use a many_to_many().
__PACKAGE__->many_to_many(books => 'book_authors', 'book');
+
#
-# Helper methods
+# Row-level helper methods
#
sub full_name {
my ($self) = @_;
@@ -105,5 +109,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_Chapter6/MyApp/lib/MyApp/Schema/Result/Book.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/Book.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/Book.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -113,9 +113,21 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QHvXdV7xNcT3CDXRI/jLjg
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:enqGmdv33Ni7uxKjN30zdQ
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
+# 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');
+
+
#
# Enable automatic date handling
#
@@ -126,13 +138,6 @@
{ 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');
=head2 author_count
@@ -148,6 +153,7 @@
return $self->authors->count;
}
+
=head2 author_list
Return a comma-separated list of authors for the current book
@@ -167,6 +173,7 @@
return join(', ', @names);
}
+
=head2 delete_allowed_by
Can the specified user delete the current book?
@@ -180,5 +187,5 @@
return $user->has_role('admin');
}
-# You can replace this text with custom content, and it will be preserved on regeneration
+
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -91,8 +91,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ClqpMc0qpOO7W5mt7sjL3w
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZMK0hr6Xt1qblHTYLKo18g
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/Role.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/Role.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/Role.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -71,8 +71,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZM+4fiRxAJxcpem7BzNCJA
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:I2Sm+YHDp9fI2mcsZ2dj8g
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/User.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/User.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/User.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -141,9 +141,12 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xfjg2vo+tmdbYqJjWt93aw
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:174DVpqYH1U4h9EGCBq87Q
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
# many_to_many():
# args:
# 1) Name of relationship, DBIC will create accessor with this name
@@ -152,6 +155,7 @@
# You must already have the has_many() defined to use a many_to_many().
__PACKAGE__->many_to_many(roles => 'user_roles', 'role');
+
# Have the 'password' column use a SHA-1 hash and 10-character salt
# with hex encoding; Generate the 'check_password" method
__PACKAGE__->add_columns(
@@ -165,6 +169,7 @@
},
);
+
=head 2 has_role
Check if a user has the specified role
@@ -179,5 +184,5 @@
return any(map { $_->role } $self->roles) eq $role;
}
-# You can replace this text with custom content, and it will be preserved on regeneration
+
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/UserRole.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/UserRole.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/Result/UserRole.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -91,8 +91,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tsDMQcH8uEP2vYbVZm6WiA
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bRXps6LBVc4JT2SWbhY0cA
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/ResultSet/Book.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/ResultSet/Book.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema/ResultSet/Book.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -36,6 +36,5 @@
});
}
-
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/Schema.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -13,8 +13,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 03:38:55
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+asok1riE0WTYfuUVE6bWg
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:11:03
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:j5kySHBu9x4UICiATq/+Uw
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/View/TT.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/View/TT.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp/View/TT.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -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,6 +30,10 @@
L<MyApp>
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/lib/MyApp.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -12,6 +12,7 @@
# Static::Simple: will serve static files from the application's root
# directory
+# Load plugins
use Catalyst qw/
-Debug
ConfigLoader
@@ -42,11 +43,11 @@
# local deployment.
__PACKAGE__->config(
- name => 'MyApp',
- # Disable deprecated behavior needed by old applications
- disable_component_resolution_regex_fallback => 1,
- session => { flash_to_stash => 1 },
-);
+ name => 'MyApp',
+ # Disable deprecated behavior needed by old applications
+ disable_component_resolution_regex_fallback => 1,
+ session => { flash_to_stash => 1 },
+ );
# Configure SimpleDB Authentication
__PACKAGE__->config->{'Plugin::Authentication'} = {
@@ -57,6 +58,7 @@
},
};
+
# Start the application
__PACKAGE__->setup();
@@ -77,6 +79,10 @@
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_Chapter6/MyApp/myapp.db
===================================================================
(Binary files differ)
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/myapp01.sql
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/myapp01.sql 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/myapp01.sql 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,7 +1,7 @@
-PRAGMA foreign_keys = ON;
--
-- Create a very simple database to hold book and author information
--
+PRAGMA foreign_keys = ON;
CREATE TABLE book (
id INTEGER PRIMARY KEY,
title TEXT ,
@@ -42,3 +42,4 @@
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_Chapter6/MyApp/myapp02.sql
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/myapp02.sql 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/myapp02.sql 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,7 +1,7 @@
-PRAGMA foreign_keys = ON;
--
-- Add user and role tables, along with a many-to-many join table
--
+PRAGMA foreign_keys = ON;
CREATE TABLE user (
id INTEGER PRIMARY KEY,
username TEXT,
@@ -32,3 +32,4 @@
INSERT INTO user_role VALUES (1, 2);
INSERT INTO user_role VALUES (2, 1);
INSERT INTO user_role VALUES (3, 1);
+
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/root/src/wrapper.tt2
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/root/src/wrapper.tt2 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/root/src/wrapper.tt2 2010-02-17 20:09:20 UTC (rev 12933)
@@ -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') %]" />
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/root/static/css/main.css
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/root/static/css/main.css 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/root/static/css/main.css 2010-02-17 20:09:20 UTC (rev 12933)
@@ -34,3 +34,4 @@
.error {
color: #f00;
}
+
Modified: trunk/examples/Tutorial/MyApp_Chapter6/MyApp/t/view_TT.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter6/MyApp/t/view_TT.t 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter6/MyApp/t/view_TT.t 2010-02-17 20:09:20 UTC (rev 12933)
@@ -2,6 +2,6 @@
use warnings;
use Test::More;
-BEGIN { use_ok 'MyApp', 'MyApp::View::TT' }
+BEGIN { use_ok 'MyApp::View::TT' }
done_testing();
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/Changes
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/Changes 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/Changes 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,4 +1,4 @@
This file documents the revision history for Perl extension MyApp.
-0.01 2010-02-07 02:42:25
+0.01 2010-02-17 15:23:50
- initial revision, generated by Catalyst
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/Makefile.PL
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/Makefile.PL 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/Makefile.PL 2010-02-17 20:09:20 UTC (rev 12933)
@@ -6,20 +6,19 @@
name 'MyApp';
all_from 'lib/MyApp.pm';
-requires 'Catalyst::Runtime' => '5.80018';
+requires 'Catalyst::Runtime' => '5.8002';
requires 'Catalyst::Plugin::ConfigLoader';
requires 'Catalyst::Plugin::Static::Simple';
-requires 'Catalyst::Plugin::StackTrace';
-requires 'Catalyst::Plugin::Authentication';
-requires 'Catalyst::Plugin::Authorization::Roles';
-requires 'Catalyst::Plugin::Session';
-requires 'Catalyst::Plugin::Session::Store::FastMmap';
-requires 'Catalyst::Plugin::Session::State::Cookie';
requires 'Catalyst::Action::RenderView';
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
+requires 'Catalyst::Plugin::Authentication';
+requires 'Catalyst::Plugin::Authorization::Roles';
+requires 'Catalyst::Plugin::Session';
+requires 'Catalyst::Plugin::Session::Store::FastMmap';
+requires 'Catalyst::Plugin::Session::State::Cookie';
test_requires 'Test::More' => '0.88';
catalyst;
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Books.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Books.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Books.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
=cut
@@ -26,21 +27,22 @@
$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
-sub list : Local {
+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];
+ # 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
@@ -48,6 +50,7 @@
$c->stash(template => 'books/list.tt2');
}
+
=head2 base
Can place common logic to start chained dispatch here
@@ -58,7 +61,7 @@
my ($self, $c) = @_;
# Store the ResultSet in stash so it's available for other methods
- $c->stash->{resultset} = $c->model('DB::Book');
+ $c->stash(resultset => $c->model('DB::Book'));
# Print a message to the debug log
$c->log->debug('*** INSIDE BASE METHOD ***');
@@ -93,11 +96,9 @@
# 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!');
@@ -115,16 +116,16 @@
my ($self, $c) = @_;
# Set the TT template to use
- $c->stash->{template} = 'books/form_create.tt2';
+ $c->stash(template => 'books/form_create.tt2');
}
=head2 form_create_do
-
+
Take information from form and add to database
-
+
=cut
-
+
sub form_create_do :Chained('base') :PathPart('form_create_do') :Args(0) {
my ($self, $c) = @_;
@@ -143,18 +144,15 @@
# Note: Above is a shortcut for this:
# $book->create_related('book_authors', {author_id => $author_id});
- # Store new model object in stash
- $c->stash->{book} = $book;
-
# Avoid Data::Dumper issue mentioned earlier
# You can probably omit this
$Data::Dumper::Useperl = 1;
- # Set the TT template to use
- $c->stash->{template} = 'books/create_done.tt2';
+ # Store new model object in stash and set template
+ $c->stash(book => $book,
+ template => 'books/create_done.tt2');
}
-
=head2 object
Fetch the specified book object based on the book ID and store
@@ -193,7 +191,7 @@
unless $c->stash->{object}->delete_allowed_by($c->user->get_object);
# Use the book object saved by 'object' and delete it along
- # with related 'book_author' entries
+ # with related 'book_authors' entries
$c->stash->{object}->delete;
# Use 'flash' to save information across requests until it's read
@@ -216,13 +214,13 @@
# Retrieve all of the book records as book model objects and store in the
# stash where they can be accessed by the TT template, but only
# retrieve books created within the last $min number of minutes
- $c->stash->{books} = [$c->model('DB::Book')
- ->created_after(DateTime->now->subtract(minutes => $mins))];
+ $c->stash(books => [$c->model('DB::Book')
+ ->created_after(DateTime->now->subtract(minutes => $mins))]);
# 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');
}
@@ -239,17 +237,22 @@
# stash where they can be accessed by the TT template, but only
# retrieve books created within the last $min number of minutes
# AND that have 'TCP' in the title
- $c->stash->{books} = [$c->model('DB::Book')
+ $c->stash(books => [$c->model('DB::Book')
->created_after(DateTime->now->subtract(minutes => $mins))
->title_like('TCP')
- ];
+ ]);
# 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 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
@@ -259,4 +262,3 @@
__PACKAGE__->meta->make_immutable;
-1;
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Login.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Login.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Login.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
Login logic
@@ -40,17 +41,22 @@
return;
} else {
# Set an error message
- $c->stash->{error_msg} = "Bad username or password.";
+ $c->stash(error_msg => "Bad username or password.");
}
} else {
# Set an error message
- $c->stash->{error_msg} = "Empty username or password.";
+ $c->stash(error_msg => "Empty username or password.");
}
# If either of above don't work out, send to the login page
- $c->stash->{template} = 'login.tt2';
+ $c->stash(template => 'login.tt2');
}
+
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Logout.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Logout.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Logout.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
Logout logic
@@ -32,6 +33,11 @@
$c->response->redirect($c->uri_for('/'));
}
+
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Root.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Root.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Root.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -20,6 +20,40 @@
=head1 METHODS
+=head2 index
+
+The root page (/)
+
+=cut
+
+sub index :Path :Args(0) {
+ my ( $self, $c ) = @_;
+
+ # Hello World
+ $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' );
+ $c->response->status(404);
+}
+
+=head2 end
+
+Attempt to render a view, if needed.
+
+=cut
+
+sub end : ActionClass('RenderView') {}
+
+
=head2 auto
Check if there is a user and, if not, forward to login page
@@ -29,7 +63,7 @@
# Note that 'auto' runs after 'begin' but before your actions and that
# 'auto's "chain" (all from application path to most specific class are run)
# See the 'Actions' section of 'Catalyst::Manual::Intro' for more info.
-sub auto : Private {
+sub auto :Private {
my ($self, $c) = @_;
# Allow unauthenticated users to reach the login page. This
@@ -56,31 +90,7 @@
return 1;
}
-=head2 index
-The root page (/)
-
-=cut
-
-sub index :Path :Args(0) {
- my ( $self, $c ) = @_;
-
- # Hello World
- $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' );
- $c->response->status(404);
-}
-
=head2 error_noperms
Permissions error screen
@@ -90,17 +100,14 @@
sub error_noperms :Chained('/') :PathPart('error_noperms') :Args(0) {
my ($self, $c) = @_;
- $c->stash->{template} = 'error_noperms.tt2';
+ $c->stash(template => 'error_noperms.tt2');
}
-=head2 end
-Attempt to render a view, if needed.
+=head1 AUTHOR
-=cut
+root
-sub end : ActionClass('RenderView') {}
-
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Model/DB.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Model/DB.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Model/DB.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -30,6 +30,10 @@
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_Chapter7/MyApp/lib/MyApp/Schema/Result/Author.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Author.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Author.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -85,9 +85,12 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oAaQWLwMfVf6x2RUSDDy3w
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zW5eyFeMspfXIYEwR03fmA
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
# many_to_many():
# args:
# 1) Name of relationship, DBIC will create accessor with this name
@@ -96,8 +99,9 @@
# You must already have the has_many() defined to use a many_to_many().
__PACKAGE__->many_to_many(books => 'book_authors', 'book');
+
#
-# Helper methods
+# Row-level helper methods
#
sub full_name {
my ($self) = @_;
@@ -105,5 +109,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_Chapter7/MyApp/lib/MyApp/Schema/Result/Book.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Book.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Book.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -113,9 +113,21 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QHvXdV7xNcT3CDXRI/jLjg
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:enqGmdv33Ni7uxKjN30zdQ
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
+# 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');
+
+
#
# Enable automatic date handling
#
@@ -126,13 +138,6 @@
{ 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');
=head2 author_count
@@ -148,6 +153,7 @@
return $self->authors->count;
}
+
=head2 author_list
Return a comma-separated list of authors for the current book
@@ -167,6 +173,7 @@
return join(', ', @names);
}
+
=head2 delete_allowed_by
Can the specified user delete the current book?
@@ -180,5 +187,5 @@
return $user->has_role('admin');
}
-# You can replace this text with custom content, and it will be preserved on regeneration
+
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -91,8 +91,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ClqpMc0qpOO7W5mt7sjL3w
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZMK0hr6Xt1qblHTYLKo18g
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Role.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Role.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Role.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -71,8 +71,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZM+4fiRxAJxcpem7BzNCJA
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:I2Sm+YHDp9fI2mcsZ2dj8g
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/User.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/User.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/User.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -141,9 +141,12 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xfjg2vo+tmdbYqJjWt93aw
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:174DVpqYH1U4h9EGCBq87Q
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
# many_to_many():
# args:
# 1) Name of relationship, DBIC will create accessor with this name
@@ -152,6 +155,7 @@
# You must already have the has_many() defined to use a many_to_many().
__PACKAGE__->many_to_many(roles => 'user_roles', 'role');
+
# Have the 'password' column use a SHA-1 hash and 10-character salt
# with hex encoding; Generate the 'check_password" method
__PACKAGE__->add_columns(
@@ -165,6 +169,7 @@
},
);
+
=head 2 has_role
Check if a user has the specified role
@@ -179,5 +184,5 @@
return any(map { $_->role } $self->roles) eq $role;
}
-# You can replace this text with custom content, and it will be preserved on regeneration
+
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/UserRole.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/UserRole.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/UserRole.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -91,8 +91,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tsDMQcH8uEP2vYbVZm6WiA
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bRXps6LBVc4JT2SWbhY0cA
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/ResultSet/Book.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/ResultSet/Book.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/ResultSet/Book.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -36,6 +36,5 @@
});
}
-
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -13,8 +13,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 03:38:55
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+asok1riE0WTYfuUVE6bWg
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:11:03
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:j5kySHBu9x4UICiATq/+Uw
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/View/TT.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/View/TT.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/View/TT.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -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,6 +30,10 @@
L<MyApp>
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -12,6 +12,7 @@
# Static::Simple: will serve static files from the application's root
# directory
+# Load plugins
use Catalyst qw/
-Debug
ConfigLoader
@@ -42,11 +43,11 @@
# local deployment.
__PACKAGE__->config(
- name => 'MyApp',
- # Disable deprecated behavior needed by old applications
- disable_component_resolution_regex_fallback => 1,
- session => { flash_to_stash => 1 },
-);
+ name => 'MyApp',
+ # Disable deprecated behavior needed by old applications
+ disable_component_resolution_regex_fallback => 1,
+ session => { flash_to_stash => 1 },
+ );
# Configure SimpleDB Authentication
__PACKAGE__->config->{'Plugin::Authentication'} = {
@@ -57,6 +58,7 @@
},
};
+
# Start the application
__PACKAGE__->setup();
@@ -77,6 +79,10 @@
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_Chapter7/MyApp/myapp.db
===================================================================
(Binary files differ)
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/myapp01.sql
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/myapp01.sql 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/myapp01.sql 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,7 +1,7 @@
-PRAGMA foreign_keys = ON;
--
-- Create a very simple database to hold book and author information
--
+PRAGMA foreign_keys = ON;
CREATE TABLE book (
id INTEGER PRIMARY KEY,
title TEXT ,
@@ -42,3 +42,4 @@
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_Chapter7/MyApp/myapp02.sql
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/myapp02.sql 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/myapp02.sql 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,7 +1,7 @@
-PRAGMA foreign_keys = ON;
--
-- Add user and role tables, along with a many-to-many join table
--
+PRAGMA foreign_keys = ON;
CREATE TABLE user (
id INTEGER PRIMARY KEY,
username TEXT,
@@ -32,3 +32,4 @@
INSERT INTO user_role VALUES (1, 2);
INSERT INTO user_role VALUES (2, 1);
INSERT INTO user_role VALUES (3, 1);
+
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/root/src/wrapper.tt2
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/root/src/wrapper.tt2 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/root/src/wrapper.tt2 2010-02-17 20:09:20 UTC (rev 12933)
@@ -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') %]" />
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/root/static/css/main.css
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/root/static/css/main.css 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/root/static/css/main.css 2010-02-17 20:09:20 UTC (rev 12933)
@@ -34,3 +34,4 @@
.error {
color: #f00;
}
+
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/view_TT.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/view_TT.t 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/view_TT.t 2010-02-17 20:09:20 UTC (rev 12933)
@@ -2,6 +2,6 @@
use warnings;
use Test::More;
-BEGIN { use_ok 'MyApp', 'MyApp::View::TT' }
+BEGIN { use_ok 'MyApp::View::TT' }
done_testing();
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/Changes
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/Changes 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/Changes 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,4 +1,4 @@
This file documents the revision history for Perl extension MyApp.
-0.01 2010-02-07 02:42:25
+0.01 2010-02-17 15:23:50
- initial revision, generated by Catalyst
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/Makefile.PL
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/Makefile.PL 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/Makefile.PL 2010-02-17 20:09:20 UTC (rev 12933)
@@ -6,20 +6,19 @@
name 'MyApp';
all_from 'lib/MyApp.pm';
-requires 'Catalyst::Runtime' => '5.80018';
+requires 'Catalyst::Runtime' => '5.8002';
requires 'Catalyst::Plugin::ConfigLoader';
requires 'Catalyst::Plugin::Static::Simple';
-requires 'Catalyst::Plugin::StackTrace';
-requires 'Catalyst::Plugin::Authentication';
-requires 'Catalyst::Plugin::Authorization::Roles';
-requires 'Catalyst::Plugin::Session';
-requires 'Catalyst::Plugin::Session::Store::FastMmap';
-requires 'Catalyst::Plugin::Session::State::Cookie';
requires 'Catalyst::Action::RenderView';
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
+requires 'Catalyst::Plugin::Authentication';
+requires 'Catalyst::Plugin::Authorization::Roles';
+requires 'Catalyst::Plugin::Session';
+requires 'Catalyst::Plugin::Session::Store::FastMmap';
+requires 'Catalyst::Plugin::Session::State::Cookie';
test_requires 'Test::More' => '0.88';
catalyst;
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Books.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Books.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Books.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
=cut
@@ -26,21 +27,22 @@
$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
-sub list : Local {
+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];
+ # 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
@@ -48,6 +50,7 @@
$c->stash(template => 'books/list.tt2');
}
+
=head2 base
Can place common logic to start chained dispatch here
@@ -58,7 +61,7 @@
my ($self, $c) = @_;
# Store the ResultSet in stash so it's available for other methods
- $c->stash->{resultset} = $c->model('DB::Book');
+ $c->stash(resultset => $c->model('DB::Book'));
# Print a message to the debug log
$c->log->debug('*** INSIDE BASE METHOD ***');
@@ -93,11 +96,9 @@
# 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!');
@@ -115,16 +116,16 @@
my ($self, $c) = @_;
# Set the TT template to use
- $c->stash->{template} = 'books/form_create.tt2';
+ $c->stash(template => 'books/form_create.tt2');
}
=head2 form_create_do
-
+
Take information from form and add to database
-
+
=cut
-
+
sub form_create_do :Chained('base') :PathPart('form_create_do') :Args(0) {
my ($self, $c) = @_;
@@ -143,18 +144,15 @@
# Note: Above is a shortcut for this:
# $book->create_related('book_authors', {author_id => $author_id});
- # Store new model object in stash
- $c->stash->{book} = $book;
-
# Avoid Data::Dumper issue mentioned earlier
# You can probably omit this
$Data::Dumper::Useperl = 1;
- # Set the TT template to use
- $c->stash->{template} = 'books/create_done.tt2';
+ # Store new model object in stash and set template
+ $c->stash(book => $book,
+ template => 'books/create_done.tt2');
}
-
=head2 object
Fetch the specified book object based on the book ID and store
@@ -193,7 +191,7 @@
unless $c->stash->{object}->delete_allowed_by($c->user->get_object);
# Use the book object saved by 'object' and delete it along
- # with related 'book_author' entries
+ # with related 'book_authors' entries
$c->stash->{object}->delete;
# Use 'flash' to save information across requests until it's read
@@ -216,13 +214,13 @@
# Retrieve all of the book records as book model objects and store in the
# stash where they can be accessed by the TT template, but only
# retrieve books created within the last $min number of minutes
- $c->stash->{books} = [$c->model('DB::Book')
- ->created_after(DateTime->now->subtract(minutes => $mins))];
+ $c->stash(books => [$c->model('DB::Book')
+ ->created_after(DateTime->now->subtract(minutes => $mins))]);
# 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');
}
@@ -239,17 +237,22 @@
# stash where they can be accessed by the TT template, but only
# retrieve books created within the last $min number of minutes
# AND that have 'TCP' in the title
- $c->stash->{books} = [$c->model('DB::Book')
+ $c->stash(books => [$c->model('DB::Book')
->created_after(DateTime->now->subtract(minutes => $mins))
->title_like('TCP')
- ];
+ ]);
# 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 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
@@ -259,4 +262,3 @@
__PACKAGE__->meta->make_immutable;
-1;
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Login.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Login.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Login.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
Login logic
@@ -40,17 +41,22 @@
return;
} else {
# Set an error message
- $c->stash->{error_msg} = "Bad username or password.";
+ $c->stash(error_msg => "Bad username or password.");
}
} else {
# Set an error message
- $c->stash->{error_msg} = "Empty username or password.";
+ $c->stash(error_msg => "Empty username or password.");
}
# If either of above don't work out, send to the login page
- $c->stash->{template} = 'login.tt2';
+ $c->stash(template => 'login.tt2');
}
+
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Logout.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Logout.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Logout.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
Logout logic
@@ -32,6 +33,11 @@
$c->response->redirect($c->uri_for('/'));
}
+
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Root.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Root.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Controller/Root.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -20,6 +20,40 @@
=head1 METHODS
+=head2 index
+
+The root page (/)
+
+=cut
+
+sub index :Path :Args(0) {
+ my ( $self, $c ) = @_;
+
+ # Hello World
+ $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' );
+ $c->response->status(404);
+}
+
+=head2 end
+
+Attempt to render a view, if needed.
+
+=cut
+
+sub end : ActionClass('RenderView') {}
+
+
=head2 auto
Check if there is a user and, if not, forward to login page
@@ -29,7 +63,7 @@
# Note that 'auto' runs after 'begin' but before your actions and that
# 'auto's "chain" (all from application path to most specific class are run)
# See the 'Actions' section of 'Catalyst::Manual::Intro' for more info.
-sub auto : Private {
+sub auto :Private {
my ($self, $c) = @_;
# Allow unauthenticated users to reach the login page. This
@@ -56,31 +90,7 @@
return 1;
}
-=head2 index
-The root page (/)
-
-=cut
-
-sub index :Path :Args(0) {
- my ( $self, $c ) = @_;
-
- # Hello World
- $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' );
- $c->response->status(404);
-}
-
=head2 error_noperms
Permissions error screen
@@ -90,17 +100,14 @@
sub error_noperms :Chained('/') :PathPart('error_noperms') :Args(0) {
my ($self, $c) = @_;
- $c->stash->{template} = 'error_noperms.tt2';
+ $c->stash(template => 'error_noperms.tt2');
}
-=head2 end
-Attempt to render a view, if needed.
+=head1 AUTHOR
-=cut
+root
-sub end : ActionClass('RenderView') {}
-
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Model/DB.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Model/DB.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Model/DB.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -3,10 +3,11 @@
use strict;
use base 'Catalyst::Model::DBIC::Schema';
+
my $dsn = $ENV{MYAPP_DSN} ||= 'dbi:SQLite:myapp.db';
__PACKAGE__->config(
schema_class => 'MyApp::Schema',
-
+
connect_info => {
dsn => $dsn,
user => '',
@@ -15,6 +16,7 @@
}
);
+
=head1 NAME
MyApp::Model::DB - Catalyst DBIC Schema Model
@@ -31,6 +33,10 @@
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_Chapter8/MyApp/lib/MyApp/Schema/Result/Author.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/Author.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/Author.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -85,9 +85,12 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oAaQWLwMfVf6x2RUSDDy3w
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zW5eyFeMspfXIYEwR03fmA
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
# many_to_many():
# args:
# 1) Name of relationship, DBIC will create accessor with this name
@@ -96,8 +99,9 @@
# You must already have the has_many() defined to use a many_to_many().
__PACKAGE__->many_to_many(books => 'book_authors', 'book');
+
#
-# Helper methods
+# Row-level helper methods
#
sub full_name {
my ($self) = @_;
@@ -105,5 +109,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_Chapter8/MyApp/lib/MyApp/Schema/Result/Book.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/Book.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/Book.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -113,9 +113,21 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QHvXdV7xNcT3CDXRI/jLjg
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:enqGmdv33Ni7uxKjN30zdQ
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
+# 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');
+
+
#
# Enable automatic date handling
#
@@ -126,13 +138,6 @@
{ 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');
=head2 author_count
@@ -148,6 +153,7 @@
return $self->authors->count;
}
+
=head2 author_list
Return a comma-separated list of authors for the current book
@@ -167,6 +173,7 @@
return join(', ', @names);
}
+
=head2 delete_allowed_by
Can the specified user delete the current book?
@@ -180,5 +187,5 @@
return $user->has_role('admin');
}
-# You can replace this text with custom content, and it will be preserved on regeneration
+
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -91,8 +91,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ClqpMc0qpOO7W5mt7sjL3w
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZMK0hr6Xt1qblHTYLKo18g
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/Role.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/Role.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/Role.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -71,8 +71,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZM+4fiRxAJxcpem7BzNCJA
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:I2Sm+YHDp9fI2mcsZ2dj8g
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/User.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/User.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/User.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -141,9 +141,12 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xfjg2vo+tmdbYqJjWt93aw
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:174DVpqYH1U4h9EGCBq87Q
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
# many_to_many():
# args:
# 1) Name of relationship, DBIC will create accessor with this name
@@ -152,6 +155,7 @@
# You must already have the has_many() defined to use a many_to_many().
__PACKAGE__->many_to_many(roles => 'user_roles', 'role');
+
# Have the 'password' column use a SHA-1 hash and 10-character salt
# with hex encoding; Generate the 'check_password" method
__PACKAGE__->add_columns(
@@ -165,8 +169,9 @@
},
);
-=head 2 has_role
+=head2 has_role
+
Check if a user has the specified role
=cut
@@ -179,5 +184,5 @@
return any(map { $_->role } $self->roles) eq $role;
}
-# You can replace this text with custom content, and it will be preserved on regeneration
+
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/UserRole.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/UserRole.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/Result/UserRole.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -91,8 +91,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tsDMQcH8uEP2vYbVZm6WiA
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bRXps6LBVc4JT2SWbhY0cA
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/ResultSet/Book.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/ResultSet/Book.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema/ResultSet/Book.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -36,6 +36,5 @@
});
}
-
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/Schema.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -13,8 +13,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 03:38:55
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+asok1riE0WTYfuUVE6bWg
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:11:03
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:j5kySHBu9x4UICiATq/+Uw
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/View/TT.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/View/TT.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp/View/TT.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -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,6 +30,10 @@
L<MyApp>
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/lib/MyApp.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -12,6 +12,7 @@
# Static::Simple: will serve static files from the application's root
# directory
+# Load plugins
use Catalyst qw/
-Debug
ConfigLoader
@@ -42,11 +43,11 @@
# local deployment.
__PACKAGE__->config(
- name => 'MyApp',
- # Disable deprecated behavior needed by old applications
- disable_component_resolution_regex_fallback => 1,
- session => { flash_to_stash => 1 },
-);
+ name => 'MyApp',
+ # Disable deprecated behavior needed by old applications
+ disable_component_resolution_regex_fallback => 1,
+ session => { flash_to_stash => 1 },
+ );
# Configure SimpleDB Authentication
__PACKAGE__->config->{'Plugin::Authentication'} = {
@@ -57,6 +58,7 @@
},
};
+
# Start the application
__PACKAGE__->setup();
@@ -77,6 +79,10 @@
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_Chapter8/MyApp/myapp.db
===================================================================
(Binary files differ)
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/myapp01.sql
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/myapp01.sql 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/myapp01.sql 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,7 +1,7 @@
-PRAGMA foreign_keys = ON;
--
-- Create a very simple database to hold book and author information
--
+PRAGMA foreign_keys = ON;
CREATE TABLE book (
id INTEGER PRIMARY KEY,
title TEXT ,
@@ -42,3 +42,4 @@
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_Chapter8/MyApp/myapp02.sql
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/myapp02.sql 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/myapp02.sql 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,7 +1,7 @@
-PRAGMA foreign_keys = ON;
--
-- Add user and role tables, along with a many-to-many join table
--
+PRAGMA foreign_keys = ON;
CREATE TABLE user (
id INTEGER PRIMARY KEY,
username TEXT,
@@ -32,3 +32,4 @@
INSERT INTO user_role VALUES (1, 2);
INSERT INTO user_role VALUES (2, 1);
INSERT INTO user_role VALUES (3, 1);
+
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/myappTEST.db
===================================================================
(Binary files differ)
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/root/src/wrapper.tt2
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/root/src/wrapper.tt2 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/root/src/wrapper.tt2 2010-02-17 20:09:20 UTC (rev 12933)
@@ -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') %]" />
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/root/static/css/main.css
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/root/static/css/main.css 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/root/static/css/main.css 2010-02-17 20:09:20 UTC (rev 12933)
@@ -34,3 +34,4 @@
.error {
color: #f00;
}
+
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/controller_Books.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/controller_Books.t 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/controller_Books.t 2010-02-17 20:09:20 UTC (rev 12933)
@@ -6,4 +6,5 @@
BEGIN { use_ok 'MyApp::Controller::Books' }
ok( request('/books')->is_redirect, 'Request should succeed' );
+
done_testing();
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/controller_Logout.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/controller_Logout.t 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/controller_Logout.t 2010-02-17 20:09:20 UTC (rev 12933)
@@ -6,4 +6,5 @@
BEGIN { use_ok 'MyApp::Controller::Logout' }
ok( request('/logout')->is_redirect, 'Request should succeed' );
+
done_testing();
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/live_app01.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/live_app01.t 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/live_app01.t 2010-02-17 20:09:20 UTC (rev 12933)
@@ -98,3 +98,4 @@
$ua2->content_contains("Unauthorized!", "Check 'test02' cannot add");
done_testing;
+
Modified: trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/view_TT.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/view_TT.t 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter8/MyApp/t/view_TT.t 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,7 +1,8 @@
use strict;
use warnings;
use Test::More;
+use MyApp;
-BEGIN { use_ok 'MyApp', 'MyApp::View::TT' }
+BEGIN { use_ok 'MyApp::View::TT' }
done_testing();
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/Changes
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/Changes 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/Changes 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,4 +1,4 @@
This file documents the revision history for Perl extension MyApp.
-0.01 2010-02-07 02:42:25
+0.01 2010-02-17 15:23:50
- initial revision, generated by Catalyst
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/Makefile.PL
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/Makefile.PL 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/Makefile.PL 2010-02-17 20:09:20 UTC (rev 12933)
@@ -6,20 +6,20 @@
name 'MyApp';
all_from 'lib/MyApp.pm';
-requires 'Catalyst::Runtime' => '5.80018';
+requires 'Catalyst::Runtime' => '5.8002';
requires 'Catalyst::Plugin::ConfigLoader';
requires 'Catalyst::Plugin::Static::Simple';
-requires 'Catalyst::Plugin::StackTrace';
+requires 'Catalyst::Action::RenderView';
+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
requires 'Catalyst::Plugin::Authentication';
requires 'Catalyst::Plugin::Authorization::Roles';
requires 'Catalyst::Plugin::Session';
requires 'Catalyst::Plugin::Session::Store::FastMmap';
requires 'Catalyst::Plugin::Session::State::Cookie';
-requires 'Catalyst::Action::RenderView';
-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
+requires 'Catalyst::Controller::HTML::FormFu';
test_requires 'Test::More' => '0.88';
catalyst;
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Books.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Books.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Books.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -4,6 +4,7 @@
BEGIN {extends 'Catalyst::Controller::HTML::FormFu'; }
+
=head1 NAME
MyApp::Controller::Books - Catalyst Controller
@@ -16,6 +17,7 @@
=cut
+
=head2 index
=cut
@@ -26,21 +28,22 @@
$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
-sub list : Local {
+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];
+ # 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
@@ -48,6 +51,7 @@
$c->stash(template => 'books/list.tt2');
}
+
=head2 base
Can place common logic to start chained dispatch here
@@ -58,7 +62,7 @@
my ($self, $c) = @_;
# Store the ResultSet in stash so it's available for other methods
- $c->stash->{resultset} = $c->model('DB::Book');
+ $c->stash(resultset => $c->model('DB::Book'));
# Print a message to the debug log
$c->log->debug('*** INSIDE BASE METHOD ***');
@@ -93,11 +97,9 @@
# 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!');
@@ -115,16 +117,16 @@
my ($self, $c) = @_;
# Set the TT template to use
- $c->stash->{template} = 'books/form_create.tt2';
+ $c->stash(template => 'books/form_create.tt2');
}
=head2 form_create_do
-
+
Take information from form and add to database
-
+
=cut
-
+
sub form_create_do :Chained('base') :PathPart('form_create_do') :Args(0) {
my ($self, $c) = @_;
@@ -143,18 +145,15 @@
# Note: Above is a shortcut for this:
# $book->create_related('book_authors', {author_id => $author_id});
- # Store new model object in stash
- $c->stash->{book} = $book;
-
# Avoid Data::Dumper issue mentioned earlier
# You can probably omit this
$Data::Dumper::Useperl = 1;
- # Set the TT template to use
- $c->stash->{template} = 'books/create_done.tt2';
+ # Store new model object in stash and set template
+ $c->stash(book => $book,
+ template => 'books/create_done.tt2');
}
-
=head2 object
Fetch the specified book object based on the book ID and store
@@ -193,7 +192,7 @@
unless $c->stash->{object}->delete_allowed_by($c->user->get_object);
# Use the book object saved by 'object' and delete it along
- # with related 'book_author' entries
+ # with related 'book_authors' entries
$c->stash->{object}->delete;
# Use 'flash' to save information across requests until it's read
@@ -216,13 +215,13 @@
# Retrieve all of the book records as book model objects and store in the
# stash where they can be accessed by the TT template, but only
# retrieve books created within the last $min number of minutes
- $c->stash->{books} = [$c->model('DB::Book')
- ->created_after(DateTime->now->subtract(minutes => $mins))];
+ $c->stash(books => [$c->model('DB::Book')
+ ->created_after(DateTime->now->subtract(minutes => $mins))]);
# 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');
}
@@ -239,17 +238,18 @@
# stash where they can be accessed by the TT template, but only
# retrieve books created within the last $min number of minutes
# AND that have 'TCP' in the title
- $c->stash->{books} = [$c->model('DB::Book')
+ $c->stash(books => [$c->model('DB::Book')
->created_after(DateTime->now->subtract(minutes => $mins))
->title_like('TCP')
- ];
+ ]);
# 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 formfu_create
Use HTML::FormFu to create a new book
@@ -293,6 +293,7 @@
$c->stash->{template} = 'books/formfu_create.tt2';
}
+
=head2 formfu_edit
Use HTML::FormFu to update an existing book
@@ -347,6 +348,11 @@
$c->stash->{template} = 'books/formfu_create.tt2';
}
+
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
@@ -356,4 +362,3 @@
__PACKAGE__->meta->make_immutable;
-1;
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Login.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Login.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Login.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
Login logic
@@ -40,17 +41,22 @@
return;
} else {
# Set an error message
- $c->stash->{error_msg} = "Bad username or password.";
+ $c->stash(error_msg => "Bad username or password.");
}
} else {
# Set an error message
- $c->stash->{error_msg} = "Empty username or password.";
+ $c->stash(error_msg => "Empty username or password.");
}
# If either of above don't work out, send to the login page
- $c->stash->{template} = 'login.tt2';
+ $c->stash(template => 'login.tt2');
}
+
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Logout.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Logout.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Logout.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -16,6 +16,7 @@
=cut
+
=head2 index
Logout logic
@@ -32,6 +33,11 @@
$c->response->redirect($c->uri_for('/'));
}
+
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Root.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Root.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Controller/Root.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -20,6 +20,40 @@
=head1 METHODS
+=head2 index
+
+The root page (/)
+
+=cut
+
+sub index :Path :Args(0) {
+ my ( $self, $c ) = @_;
+
+ # Hello World
+ $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' );
+ $c->response->status(404);
+}
+
+=head2 end
+
+Attempt to render a view, if needed.
+
+=cut
+
+sub end : ActionClass('RenderView') {}
+
+
=head2 auto
Check if there is a user and, if not, forward to login page
@@ -29,7 +63,7 @@
# Note that 'auto' runs after 'begin' but before your actions and that
# 'auto's "chain" (all from application path to most specific class are run)
# See the 'Actions' section of 'Catalyst::Manual::Intro' for more info.
-sub auto : Private {
+sub auto :Private {
my ($self, $c) = @_;
# Allow unauthenticated users to reach the login page. This
@@ -56,31 +90,7 @@
return 1;
}
-=head2 index
-The root page (/)
-
-=cut
-
-sub index :Path :Args(0) {
- my ( $self, $c ) = @_;
-
- # Hello World
- $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' );
- $c->response->status(404);
-}
-
=head2 error_noperms
Permissions error screen
@@ -90,17 +100,14 @@
sub error_noperms :Chained('/') :PathPart('error_noperms') :Args(0) {
my ($self, $c) = @_;
- $c->stash->{template} = 'error_noperms.tt2';
+ $c->stash(template => 'error_noperms.tt2');
}
-=head2 end
-Attempt to render a view, if needed.
+=head1 AUTHOR
-=cut
+root
-sub end : ActionClass('RenderView') {}
-
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Model/DB.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Model/DB.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Model/DB.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -3,10 +3,11 @@
use strict;
use base 'Catalyst::Model::DBIC::Schema';
+
my $dsn = $ENV{MYAPP_DSN} ||= 'dbi:SQLite:myapp.db';
__PACKAGE__->config(
schema_class => 'MyApp::Schema',
-
+
connect_info => {
dsn => $dsn,
user => '',
@@ -15,6 +16,7 @@
}
);
+
=head1 NAME
MyApp::Model::DB - Catalyst DBIC Schema Model
@@ -31,6 +33,10 @@
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_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/Author.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/Author.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/Author.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -85,9 +85,12 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oAaQWLwMfVf6x2RUSDDy3w
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zW5eyFeMspfXIYEwR03fmA
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
# many_to_many():
# args:
# 1) Name of relationship, DBIC will create accessor with this name
@@ -96,8 +99,9 @@
# You must already have the has_many() defined to use a many_to_many().
__PACKAGE__->many_to_many(books => 'book_authors', 'book');
+
#
-# Helper methods
+# Row-level helper methods
#
sub full_name {
my ($self) = @_;
@@ -105,5 +109,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_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/Book.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/Book.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/Book.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -113,9 +113,21 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QHvXdV7xNcT3CDXRI/jLjg
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:enqGmdv33Ni7uxKjN30zdQ
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
+# 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');
+
+
#
# Enable automatic date handling
#
@@ -126,13 +138,6 @@
{ 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');
=head2 author_count
@@ -148,6 +153,7 @@
return $self->authors->count;
}
+
=head2 author_list
Return a comma-separated list of authors for the current book
@@ -167,6 +173,7 @@
return join(', ', @names);
}
+
=head2 delete_allowed_by
Can the specified user delete the current book?
@@ -180,5 +187,5 @@
return $user->has_role('admin');
}
-# You can replace this text with custom content, and it will be preserved on regeneration
+
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -91,8 +91,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ClqpMc0qpOO7W5mt7sjL3w
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZMK0hr6Xt1qblHTYLKo18g
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/Role.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/Role.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/Role.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -71,8 +71,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZM+4fiRxAJxcpem7BzNCJA
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:I2Sm+YHDp9fI2mcsZ2dj8g
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/User.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/User.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/User.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -141,9 +141,12 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xfjg2vo+tmdbYqJjWt93aw
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:174DVpqYH1U4h9EGCBq87Q
+
+# You can replace this text with custom content, and it will be preserved on regeneration
+
# many_to_many():
# args:
# 1) Name of relationship, DBIC will create accessor with this name
@@ -152,6 +155,7 @@
# You must already have the has_many() defined to use a many_to_many().
__PACKAGE__->many_to_many(roles => 'user_roles', 'role');
+
# Have the 'password' column use a SHA-1 hash and 10-character salt
# with hex encoding; Generate the 'check_password" method
__PACKAGE__->add_columns(
@@ -165,8 +169,9 @@
},
);
-=head 2 has_role
+=head2 has_role
+
Check if a user has the specified role
=cut
@@ -179,5 +184,5 @@
return any(map { $_->role } $self->roles) eq $role;
}
-# You can replace this text with custom content, and it will be preserved on regeneration
+
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/UserRole.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/UserRole.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/Result/UserRole.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -91,8 +91,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tsDMQcH8uEP2vYbVZm6WiA
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:27:48
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:bRXps6LBVc4JT2SWbhY0cA
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/ResultSet/Book.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/ResultSet/Book.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema/ResultSet/Book.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -36,6 +36,5 @@
});
}
-
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/Schema.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -13,8 +13,8 @@
);
-# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 03:38:55
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+asok1riE0WTYfuUVE6bWg
+# Created by DBIx::Class::Schema::Loader v0.05002 @ 2010-02-17 16:11:03
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:j5kySHBu9x4UICiATq/+Uw
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/View/TT.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/View/TT.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp/View/TT.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -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,6 +30,10 @@
L<MyApp>
+=head1 AUTHOR
+
+root
+
=head1 LICENSE
This library is free software. You can redistribute it and/or modify
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp.pm 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/lib/MyApp.pm 2010-02-17 20:09:20 UTC (rev 12933)
@@ -12,6 +12,7 @@
# Static::Simple: will serve static files from the application's root
# directory
+# Load plugins
use Catalyst qw/
-Debug
ConfigLoader
@@ -42,11 +43,11 @@
# local deployment.
__PACKAGE__->config(
- name => 'MyApp',
- # Disable deprecated behavior needed by old applications
- disable_component_resolution_regex_fallback => 1,
- session => { flash_to_stash => 1 },
-);
+ name => 'MyApp',
+ # Disable deprecated behavior needed by old applications
+ disable_component_resolution_regex_fallback => 1,
+ session => { flash_to_stash => 1 },
+ );
# Configure SimpleDB Authentication
__PACKAGE__->config->{'Plugin::Authentication'} = {
@@ -57,6 +58,7 @@
},
};
+
# Start the application
__PACKAGE__->setup();
@@ -77,6 +79,10 @@
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_Chapter9_FormFu/MyApp/myapp.db
===================================================================
(Binary files differ)
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/myapp01.sql
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/myapp01.sql 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/myapp01.sql 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,7 +1,7 @@
-PRAGMA foreign_keys = ON;
--
-- Create a very simple database to hold book and author information
--
+PRAGMA foreign_keys = ON;
CREATE TABLE book (
id INTEGER PRIMARY KEY,
title TEXT ,
@@ -42,3 +42,4 @@
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_Chapter9_FormFu/MyApp/myapp02.sql
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/myapp02.sql 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/myapp02.sql 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,7 +1,7 @@
-PRAGMA foreign_keys = ON;
--
-- Add user and role tables, along with a many-to-many join table
--
+PRAGMA foreign_keys = ON;
CREATE TABLE user (
id INTEGER PRIMARY KEY,
username TEXT,
@@ -32,3 +32,4 @@
INSERT INTO user_role VALUES (1, 2);
INSERT INTO user_role VALUES (2, 1);
INSERT INTO user_role VALUES (3, 1);
+
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/myappTEST.db
===================================================================
(Binary files differ)
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/root/src/books/formfu_create.tt2
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/root/src/books/formfu_create.tt2 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/root/src/books/formfu_create.tt2 2010-02-17 20:09:20 UTC (rev 12933)
@@ -3,4 +3,5 @@
[%# Render the HTML::FormFu Form %]
[% form %]
-<p><a href="[% c.uri_for(c.controller.action_for('list')) %]">Return to book list</a></p>
+<p><a href="[% c.uri_for(c.controller.action_for('list'))
+ %]">Return to book list</a></p>
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/root/src/wrapper.tt2
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/root/src/wrapper.tt2 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/root/src/wrapper.tt2 2010-02-17 20:09:20 UTC (rev 12933)
@@ -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') %]" />
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/root/static/css/main.css
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/root/static/css/main.css 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/root/static/css/main.css 2010-02-17 20:09:20 UTC (rev 12933)
@@ -44,3 +44,5 @@
padding-top: .5em;
display: block;
}
+
+
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/controller_Books.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/controller_Books.t 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/controller_Books.t 2010-02-17 20:09:20 UTC (rev 12933)
@@ -6,4 +6,5 @@
BEGIN { use_ok 'MyApp::Controller::Books' }
ok( request('/books')->is_redirect, 'Request should succeed' );
+
done_testing();
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/controller_Logout.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/controller_Logout.t 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/controller_Logout.t 2010-02-17 20:09:20 UTC (rev 12933)
@@ -6,4 +6,5 @@
BEGIN { use_ok 'MyApp::Controller::Logout' }
ok( request('/logout')->is_redirect, 'Request should succeed' );
+
done_testing();
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/live_app01.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/live_app01.t 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/live_app01.t 2010-02-17 20:09:20 UTC (rev 12933)
@@ -98,3 +98,4 @@
$ua2->content_contains("Unauthorized!", "Check 'test02' cannot add");
done_testing;
+
Modified: trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/view_TT.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/view_TT.t 2010-02-17 19:39:32 UTC (rev 12932)
+++ trunk/examples/Tutorial/MyApp_Chapter9_FormFu/MyApp/t/view_TT.t 2010-02-17 20:09:20 UTC (rev 12933)
@@ -1,7 +1,8 @@
use strict;
use warnings;
use Test::More;
+use MyApp;
-BEGIN { use_ok 'MyApp', 'MyApp::View::TT' }
+BEGIN { use_ok 'MyApp::View::TT' }
done_testing();
More information about the Catalyst-commits
mailing list