[Catalyst-commits] r12824 - in
trunk/examples/Tutorial/MyApp_Chapter7/MyApp: . lib lib/MyApp
lib/MyApp/Controller lib/MyApp/Model lib/MyApp/Schema/Result
lib/MyApp/Schema/ResultSet lib/MyApp/View root/src t
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Sun Feb 7 11:29:50 GMT 2010
Author: caelum
Date: 2010-02-07 11:29:48 +0000 (Sun, 07 Feb 2010)
New Revision: 12824
Modified:
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.conf
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/t/01app.t
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/02pod.t
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/03podcoverage.t
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/controller_Books.t
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/controller_Login.t
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/controller_Logout.t
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/model_DB.t
trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/view_TT.t
Log:
update chapter 7 code (same as chapter 6)
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/Changes
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/Changes 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/Changes 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,4 +1,4 @@
This file documents the revision history for Perl extension MyApp.
-0.01 2009-05-25 13:48:10
+0.01 2010-02-07 02:42:25
- initial revision, generated by Catalyst
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/Makefile.PL
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/Makefile.PL 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/Makefile.PL 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,27 +1,26 @@
+#!/usr/bin/env perl
# IMPORTANT: if you delete this file your app will not work as
-# expected. you have been warned
+# expected. You have been warned.
use inc::Module::Install;
name 'MyApp';
all_from 'lib/MyApp.pm';
-requires 'Catalyst::Runtime' => '5.80004';
+requires 'Catalyst::Runtime' => '5.80018';
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 'parent';
+requires 'Moose';
+requires 'namespace::autoclean';
requires 'Config::General'; # This should reflect the config file format you've chosen
# See Catalyst::Plugin::ConfigLoader for supported formats
-
-# Add modules required for this app
-requires (
- 'Catalyst::Plugin::Authentication' => '0',
- 'Catalyst::Plugin::Session' => '0',
- 'Catalyst::Plugin::Session::Store::FastMmap' => '0',
- 'Catalyst::Plugin::Session::State::Cookie' => '0',
- 'Catalyst::Plugin::Authorization::Roles' => '0',
-);
-
+test_requires 'Test::More' => '0.88';
catalyst;
install_script glob('script/*.pl');
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-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Books.pm 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,8 +1,8 @@
package MyApp::Controller::Books;
+use Moose;
+use namespace::autoclean;
-use strict;
-use warnings;
-use parent 'Catalyst::Controller';
+BEGIN {extends 'Catalyst::Controller'; }
=head1 NAME
@@ -16,7 +16,6 @@
=cut
-
=head2 index
=cut
@@ -27,7 +26,6 @@
$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
@@ -47,11 +45,9 @@
# Set the TT template to use. You will almost always want to do this
# in your action methods (action methods respond to user input in
# your controllers).
- $c->stash->{template} = 'books/list.tt2';
+ $c->stash(template => 'books/list.tt2');
}
-
-
=head2 base
Can place common logic to start chained dispatch here
@@ -69,32 +65,6 @@
}
-
-=head2 object
-
-Fetch the specified book object based on the book ID and store
-it in the stash
-
-=cut
-
-sub object :Chained('base') :PathPart('id') :CaptureArgs(1) {
- # $id = primary key of book to delete
- my ($self, $c, $id) = @_;
-
- # Find the book object and store it in the stash
- $c->stash(object => $c->stash->{resultset}->find($id));
-
- # Make sure the lookup was successful. You would probably
- # want to do something like this in a real app:
- # $c->detach('/error_404') if !$c->stash->{object};
- die "Book $id not found!" if !$c->stash->{object};
-
- # Print a message to the debug log
- $c->log->debug("*** INSIDE OBJECT METHOD for obj id=$id ***");
-}
-
-
-
=head2 url_create
Create a book with the supplied title and rating,
@@ -135,7 +105,6 @@
}
-
=head2 form_create
Display form to collect information for book to create
@@ -150,7 +119,6 @@
}
-
=head2 form_create_do
Take information from form and add to database
@@ -187,7 +155,30 @@
}
+=head2 object
+Fetch the specified book object based on the book ID and store
+it in the stash
+
+=cut
+
+sub object :Chained('base') :PathPart('id') :CaptureArgs(1) {
+ # $id = primary key of book to delete
+ my ($self, $c, $id) = @_;
+
+ # Find the book object and store it in the stash
+ $c->stash(object => $c->stash->{resultset}->find($id));
+
+ # Make sure the lookup was successful. You would probably
+ # want to do something like this in a real app:
+ # $c->detach('/error_404') if !$c->stash->{object};
+ die "Book $id not found!" if !$c->stash->{object};
+
+ # Print a message to the debug log
+ $c->log->debug("*** INSIDE OBJECT METHOD for obj id=$id ***");
+}
+
+
=head2 delete
Delete a book
@@ -202,7 +193,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_authors' entries
+ # with related 'book_author' entries
$c->stash->{object}->delete;
# Use 'flash' to save information across requests until it's read
@@ -213,7 +204,6 @@
}
-
=head2 list_recent
List recently created books
@@ -260,17 +250,13 @@
$c->stash->{template} = 'books/list.tt2';
}
-
-
-=head1 AUTHOR
-
-root
-
=head1 LICENSE
-This library is free software, you can redistribute it and/or modify
+This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
+__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-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Login.pm 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,8 +1,8 @@
package MyApp::Controller::Login;
+use Moose;
+use namespace::autoclean;
-use strict;
-use warnings;
-use parent 'Catalyst::Controller';
+BEGIN {extends 'Catalyst::Controller'; }
=head1 NAME
@@ -16,7 +16,6 @@
=cut
-
=head2 index
Login logic
@@ -27,8 +26,8 @@
my ($self, $c) = @_;
# Get the username and password from form
- my $username = $c->request->params->{username} || "";
- my $password = $c->request->params->{password} || "";
+ my $username = $c->request->params->{username};
+ my $password = $c->request->params->{password};
# If the username and password values were found in form
if ($username && $password) {
@@ -43,23 +42,21 @@
# Set an error message
$c->stash->{error_msg} = "Bad username or password.";
}
+ } else {
+ # Set an error message
+ $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';
}
-
-
-=head1 AUTHOR
-
-root
-
=head1 LICENSE
-This library is free software, you can redistribute it and/or modify
+This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
-1;
+__PACKAGE__->meta->make_immutable;
+
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-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Logout.pm 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,8 +1,8 @@
package MyApp::Controller::Logout;
+use Moose;
+use namespace::autoclean;
-use strict;
-use warnings;
-use parent 'Catalyst::Controller';
+BEGIN {extends 'Catalyst::Controller'; }
=head1 NAME
@@ -16,7 +16,6 @@
=cut
-
=head2 index
Logout logic
@@ -33,16 +32,12 @@
$c->response->redirect($c->uri_for('/'));
}
-
-=head1 AUTHOR
-
-root
-
=head1 LICENSE
-This library is free software, you can redistribute it and/or modify
+This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
-1;
+__PACKAGE__->meta->make_immutable;
+
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-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Controller/Root.pm 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,14 +1,14 @@
package MyApp::Controller::Root;
+use Moose;
+use namespace::autoclean;
-use strict;
-use warnings;
-use parent 'Catalyst::Controller';
+BEGIN { extends 'Catalyst::Controller' }
#
# Sets the actions in this controller to be registered with no prefix
# so they function identically to actions created in MyApp.pm
#
-__PACKAGE__->config->{namespace} = '';
+__PACKAGE__->config(namespace => '');
=head1 NAME
@@ -20,34 +20,6 @@
=head1 METHODS
-=cut
-
-=head2 index
-
-=cut
-
-sub index :Path :Args(0) {
- my ( $self, $c ) = @_;
-
- # Hello World
- $c->response->body( $c->welcome_message );
-}
-
-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
@@ -84,29 +56,58 @@
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
=cut
-sub error_noperms :Chained('/') :PathPath('error_noperms') :Args(0) {
+sub error_noperms :Chained('/') :PathPart('error_noperms') :Args(0) {
my ($self, $c) = @_;
$c->stash->{template} = 'error_noperms.tt2';
}
+=head2 end
-=head1 AUTHOR
+Attempt to render a view, if needed.
-root
+=cut
+sub end : ActionClass('RenderView') {}
+
=head1 LICENSE
-This library is free software, you can redistribute it and/or modify
+This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
+__PACKAGE__->meta->make_immutable;
+
1;
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-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Model/DB.pm 2010-02-07 11:29:48 UTC (rev 12824)
@@ -5,15 +5,19 @@
__PACKAGE__->config(
schema_class => 'MyApp::Schema',
- connect_info => [
- 'dbi:SQLite:myapp.db',
-
- ],
+
+ connect_info => {
+ dsn => 'dbi:SQLite:myapp.db',
+ user => '',
+ password => '',
+ on_connect_do => q{PRAGMA foreign_keys = ON},
+ }
);
=head1 NAME
MyApp::Model::DB - Catalyst DBIC Schema Model
+
=head1 SYNOPSIS
See L<MyApp>
@@ -22,9 +26,9 @@
L<Catalyst::Model::DBIC::Schema> Model using schema L<MyApp::Schema>
-=head1 AUTHOR
+=head1 GENERATED BY
-root
+Catalyst::Helper::Model::DBIC::Schema - 0.4
=head1 LICENSE
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-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Author.pm 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,12 +1,48 @@
package MyApp::Schema::Result::Author;
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
use strict;
use warnings;
-use base 'DBIx::Class';
+use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "EncodedColumn", "Core");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "EncodedColumn");
+
+=head1 NAME
+
+MyApp::Schema::Result::Author
+
+=cut
+
__PACKAGE__->table("author");
+
+=head1 ACCESSORS
+
+=head2 id
+
+ data_type: INTEGER
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=head2 first_name
+
+ data_type: TEXT
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=head2 last_name
+
+ data_type: TEXT
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=cut
+
__PACKAGE__->add_columns(
"id",
{
@@ -32,24 +68,26 @@
);
__PACKAGE__->set_primary_key("id");
+=head1 RELATIONS
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-05-25 23:58:21
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:NXdFpHVaaGNO+7MEEm/ufw
+=head2 book_authors
+Type: has_many
-# You can replace this text with custom content, and it will be preserved on regeneration
+Related object: L<MyApp::Schema::Result::BookAuthor>
-#
-# Set relationships:
-#
+=cut
-# has_many():
-# args:
-# 1) Name of relationship, DBIC will create an accessor with this name
-# 2) Name of the model class referenced by this relationship
-# 3) Column name in *foreign* table (aka, foreign key in peer table)
-__PACKAGE__->has_many(book_authors => 'MyApp::Schema::Result::BookAuthor', 'author_id');
+__PACKAGE__->has_many(
+ "book_authors",
+ "MyApp::Schema::Result::BookAuthor",
+ { "foreign.author_id" => "self.id" },
+);
+
+# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:oAaQWLwMfVf6x2RUSDDy3w
+
# many_to_many():
# args:
# 1) Name of relationship, DBIC will create accessor with this name
@@ -58,7 +96,6 @@
# You must already have the has_many() defined to use a many_to_many().
__PACKAGE__->many_to_many(books => 'book_authors', 'book');
-
#
# Helper methods
#
@@ -68,5 +105,5 @@
return $self->first_name . ' ' . $self->last_name;
}
-
+# You can replace this text with custom content, and it will be preserved on regeneration
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Book.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Book.pm 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Book.pm 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,12 +1,62 @@
package MyApp::Schema::Result::Book;
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
use strict;
use warnings;
-use base 'DBIx::Class';
+use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "EncodedColumn", "Core");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "EncodedColumn");
+
+=head1 NAME
+
+MyApp::Schema::Result::Book
+
+=cut
+
__PACKAGE__->table("book");
+
+=head1 ACCESSORS
+
+=head2 id
+
+ data_type: INTEGER
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=head2 title
+
+ data_type: TEXT
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=head2 rating
+
+ data_type: INTEGER
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=head2 created
+
+ data_type: INTEGER
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=head2 updated
+
+ data_type: INTEGER
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=cut
+
__PACKAGE__->add_columns(
"id",
{
@@ -46,32 +96,25 @@
);
__PACKAGE__->set_primary_key("id");
+=head1 RELATIONS
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-05-25 23:58:21
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/LmqlHxlI+J1JQySHrLB9w
+=head2 book_authors
+Type: has_many
-# You can replace this text with custom content, and it will be preserved on regeneration
+Related object: L<MyApp::Schema::Result::BookAuthor>
-#
-# Set relationships:
-#
+=cut
-# has_many():
-# args:
-# 1) Name of relationship, DBIC will create accessor with this name
-# 2) Name of the model class referenced by this relationship
-# 3) Column name in *foreign* table (aka, foreign key in peer table)
-__PACKAGE__->has_many(book_authors => 'MyApp::Schema::Result::BookAuthor', 'book_id');
+__PACKAGE__->has_many(
+ "book_authors",
+ "MyApp::Schema::Result::BookAuthor",
+ { "foreign.book_id" => "self.id" },
+);
-# many_to_many():
-# args:
-# 1) Name of relationship, DBIC will create accessor with this name
-# 2) Name of has_many() relationship this many_to_many() is shortcut for
-# 3) Name of belongs_to() relationship in model class of has_many() above
-# You must already have the has_many() defined to use a many_to_many().
-__PACKAGE__->many_to_many(authors => 'book_authors', 'author');
+# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:QHvXdV7xNcT3CDXRI/jLjg
#
# Enable automatic date handling
@@ -83,14 +126,14 @@
{ data_type => 'datetime', set_on_create => 1, set_on_update => 1 },
);
+# many_to_many():
+# args:
+# 1) Name of relationship, DBIC will create accessor with this name
+# 2) Name of has_many() relationship this many_to_many() is shortcut for
+# 3) Name of belongs_to() relationship in model class of has_many() above
+# You must already have the has_many() defined to use a many_to_many().
+__PACKAGE__->many_to_many(authors => 'book_authors', 'author');
-#
-# Set ResultSet Class
-#
-__PACKAGE__->resultset_class('MyApp::Schema::ResultSet::Book');
-
-
-
=head2 author_count
Return the number of authors for the current book
@@ -105,7 +148,6 @@
return $self->authors->count;
}
-
=head2 author_list
Return a comma-separated list of authors for the current book
@@ -125,7 +167,6 @@
return join(', ', @names);
}
-
=head2 delete_allowed_by
Can the specified user delete the current book?
@@ -139,5 +180,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-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/BookAuthor.pm 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,17 +1,49 @@
package MyApp::Schema::Result::BookAuthor;
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
use strict;
use warnings;
-use base 'DBIx::Class';
+use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "EncodedColumn", "Core");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "EncodedColumn");
+
+=head1 NAME
+
+MyApp::Schema::Result::BookAuthor
+
+=cut
+
__PACKAGE__->table("book_author");
+
+=head1 ACCESSORS
+
+=head2 book_id
+
+ data_type: INTEGER
+ default_value: undef
+ is_foreign_key: 1
+ is_nullable: 1
+ size: undef
+
+=head2 author_id
+
+ data_type: INTEGER
+ default_value: undef
+ is_foreign_key: 1
+ is_nullable: 1
+ size: undef
+
+=cut
+
__PACKAGE__->add_columns(
"book_id",
{
data_type => "INTEGER",
default_value => undef,
+ is_foreign_key => 1,
is_nullable => 1,
size => undef,
},
@@ -19,37 +51,49 @@
{
data_type => "INTEGER",
default_value => undef,
+ is_foreign_key => 1,
is_nullable => 1,
size => undef,
},
);
__PACKAGE__->set_primary_key("book_id", "author_id");
+=head1 RELATIONS
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-05-25 23:58:21
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Jnk0/lK+DK0au6JwLeJU3A
+=head2 book
+Type: belongs_to
-# You can replace this text with custom content, and it will be preserved on regeneration
+Related object: L<MyApp::Schema::Result::Book>
-#
-# Set relationships:
-#
+=cut
-# belongs_to():
-# args:
-# 1) Name of relationship, DBIC will create accessor with this name
-# 2) Name of the model class referenced by this relationship
-# 3) Column name in *this* table
-__PACKAGE__->belongs_to(book => 'MyApp::Schema::Result::Book', 'book_id');
+__PACKAGE__->belongs_to(
+ "book",
+ "MyApp::Schema::Result::Book",
+ { id => "book_id" },
+ { join_type => "LEFT" },
+);
-# belongs_to():
-# args:
-# 1) Name of relationship, DBIC will create accessor with this name
-# 2) Name of the model class referenced by this relationship
-# 3) Column name in *this* table
-__PACKAGE__->belongs_to(author => 'MyApp::Schema::Result::Author', 'author_id');
+=head2 author
+Type: belongs_to
+Related object: L<MyApp::Schema::Result::Author>
+=cut
+
+__PACKAGE__->belongs_to(
+ "author",
+ "MyApp::Schema::Result::Author",
+ { id => "author_id" },
+ { join_type => "LEFT" },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ClqpMc0qpOO7W5mt7sjL3w
+
+
+# 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/Role.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Role.pm 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/Role.pm 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,12 +1,41 @@
package MyApp::Schema::Result::Role;
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
use strict;
use warnings;
-use base 'DBIx::Class';
+use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "EncodedColumn", "Core");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "EncodedColumn");
+
+=head1 NAME
+
+MyApp::Schema::Result::Role
+
+=cut
+
__PACKAGE__->table("role");
+
+=head1 ACCESSORS
+
+=head2 id
+
+ data_type: INTEGER
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=head2 role
+
+ data_type: TEXT
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=cut
+
__PACKAGE__->add_columns(
"id",
{
@@ -25,18 +54,26 @@
);
__PACKAGE__->set_primary_key("id");
+=head1 RELATIONS
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-05-25 23:58:21
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:48JMMpB17YYn6x8/XSN7WA
+=head2 user_roles
+Type: has_many
-# You can replace this text with custom content, and it will be preserved on regeneration
+Related object: L<MyApp::Schema::Result::UserRole>
-# has_many():
-# args:
-# 1) Name of relationship, DBIC will create accessor with this name
-# 2) Name of the model class referenced by this relationship
-# 3) Column name in *foreign* table (aka, foreign key in peer table)
-__PACKAGE__->has_many(map_user_roles => 'MyApp::Schema::Result::UserRole', 'role_id');
+=cut
+__PACKAGE__->has_many(
+ "user_roles",
+ "MyApp::Schema::Result::UserRole",
+ { "foreign.role_id" => "self.id" },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:ZM+4fiRxAJxcpem7BzNCJA
+
+
+# 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/User.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/User.pm 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/User.pm 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,12 +1,76 @@
package MyApp::Schema::Result::User;
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
use strict;
use warnings;
-use base 'DBIx::Class';
+use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "EncodedColumn", "Core");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "EncodedColumn");
+
+=head1 NAME
+
+MyApp::Schema::Result::User
+
+=cut
+
__PACKAGE__->table("user");
+
+=head1 ACCESSORS
+
+=head2 id
+
+ data_type: INTEGER
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=head2 username
+
+ data_type: TEXT
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=head2 password
+
+ data_type: TEXT
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=head2 email_address
+
+ data_type: TEXT
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=head2 first_name
+
+ data_type: TEXT
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=head2 last_name
+
+ data_type: TEXT
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=head2 active
+
+ data_type: INTEGER
+ default_value: undef
+ is_nullable: 1
+ size: undef
+
+=cut
+
__PACKAGE__->add_columns(
"id",
{
@@ -60,33 +124,34 @@
);
__PACKAGE__->set_primary_key("id");
+=head1 RELATIONS
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-05-25 23:58:21
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:uNXlBoyXjmcKWg4pSeY/CQ
+=head2 user_roles
+Type: has_many
-# You can replace this text with custom content, and it will be preserved on regeneration
+Related object: L<MyApp::Schema::Result::UserRole>
-#
-# Set relationships:
-#
+=cut
-# has_many():
-# args:
-# 1) Name of relationship, DBIC will create accessor with this name
-# 2) Name of the model class referenced by this relationship
-# 3) Column name in *foreign* table (aka, foreign key in peer table)
-__PACKAGE__->has_many(map_user_roles => 'MyApp::Schema::Result::UserRole', 'user_id');
+__PACKAGE__->has_many(
+ "user_roles",
+ "MyApp::Schema::Result::UserRole",
+ { "foreign.user_id" => "self.id" },
+);
+
+# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:xfjg2vo+tmdbYqJjWt93aw
+
# 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(roles => 'map_user_roles', 'role');
+__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(
@@ -100,7 +165,6 @@
},
);
-
=head 2 has_role
Check if a user has the specified role
@@ -115,5 +179,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-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/Result/UserRole.pm 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,17 +1,49 @@
package MyApp::Schema::Result::UserRole;
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
use strict;
use warnings;
-use base 'DBIx::Class';
+use base 'DBIx::Class::Core';
-__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "EncodedColumn", "Core");
+__PACKAGE__->load_components("InflateColumn::DateTime", "TimeStamp", "EncodedColumn");
+
+=head1 NAME
+
+MyApp::Schema::Result::UserRole
+
+=cut
+
__PACKAGE__->table("user_role");
+
+=head1 ACCESSORS
+
+=head2 user_id
+
+ data_type: INTEGER
+ default_value: undef
+ is_foreign_key: 1
+ is_nullable: 1
+ size: undef
+
+=head2 role_id
+
+ data_type: INTEGER
+ default_value: undef
+ is_foreign_key: 1
+ is_nullable: 1
+ size: undef
+
+=cut
+
__PACKAGE__->add_columns(
"user_id",
{
data_type => "INTEGER",
default_value => undef,
+ is_foreign_key => 1,
is_nullable => 1,
size => undef,
},
@@ -19,35 +51,49 @@
{
data_type => "INTEGER",
default_value => undef,
+ is_foreign_key => 1,
is_nullable => 1,
size => undef,
},
);
__PACKAGE__->set_primary_key("user_id", "role_id");
+=head1 RELATIONS
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-05-25 23:58:21
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:grzGbp+8KXE/BP8eOvxglw
+=head2 user
+Type: belongs_to
-# You can replace this text with custom content, and it will be preserved on regeneration
+Related object: L<MyApp::Schema::Result::User>
-#
-# Set relationships:
-#
+=cut
-# belongs_to():
-# args:
-# 1) Name of relationship, DBIC will create accessor with this name
-# 2) Name of the model class referenced by this relationship
-# 3) Column name in *this* table
-__PACKAGE__->belongs_to(user => 'MyApp::Schema::Result::User', 'user_id');
+__PACKAGE__->belongs_to(
+ "user",
+ "MyApp::Schema::Result::User",
+ { id => "user_id" },
+ { join_type => "LEFT" },
+);
-# belongs_to():
-# args:
-# 1) Name of relationship, DBIC will create accessor with this name
-# 2) Name of the model class referenced by this relationship
-# 3) Column name in *this* table
-__PACKAGE__->belongs_to(role => 'MyApp::Schema::Result::Role', 'role_id');
+=head2 role
+Type: belongs_to
+
+Related object: L<MyApp::Schema::Result::Role>
+
+=cut
+
+__PACKAGE__->belongs_to(
+ "role",
+ "MyApp::Schema::Result::Role",
+ { id => "role_id" },
+ { join_type => "LEFT" },
+);
+
+
+# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 04:49:36
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tsDMQcH8uEP2vYbVZm6WiA
+
+
+# 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/ResultSet/Book.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/ResultSet/Book.pm 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema/ResultSet/Book.pm 2010-02-07 11:29:48 UTC (rev 12824)
@@ -13,7 +13,7 @@
sub created_after {
my ($self, $datetime) = @_;
- my $date_str = $self->_source_handle->schema->storage
+ my $date_str = $self->result_source->schema->storage
->datetime_parser->format_datetime($datetime);
return $self->search({
@@ -36,5 +36,6 @@
});
}
+
1;
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema.pm 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/Schema.pm 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,15 +1,20 @@
package MyApp::Schema;
+# Created by DBIx::Class::Schema::Loader
+# DO NOT MODIFY THE FIRST PART OF THIS FILE
+
use strict;
use warnings;
use base 'DBIx::Class::Schema';
-__PACKAGE__->load_namespaces;
+__PACKAGE__->load_namespaces(
+ result_namespace => 'Result',
+);
-# Created by DBIx::Class::Schema::Loader v0.04006 @ 2009-05-25 23:58:21
-# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:Yt5GyXj4neXT3xyUwn5TIw
+# Created by DBIx::Class::Schema::Loader v0.05001 @ 2010-02-07 03:38:55
+# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:+asok1riE0WTYfuUVE6bWg
# You can replace this text with custom content, and it will be preserved on regeneration
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/View/TT.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/View/TT.pm 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp/View/TT.pm 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,11 +1,13 @@
package MyApp::View::TT;
use strict;
+use warnings;
+
use base 'Catalyst::View::TT';
__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' ),
@@ -16,26 +18,21 @@
WRAPPER => 'wrapper.tt2',
);
-
=head1 NAME
MyApp::View::TT - TT View for MyApp
=head1 DESCRIPTION
-TT View for MyApp.
+TT View for MyApp.
=head1 SEE ALSO
L<MyApp>
-=head1 AUTHOR
-
-root
-
=head1 LICENSE
-This library is free software, you can redistribute it and/or modify
+This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp.pm
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp.pm 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/lib/MyApp.pm 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,10 +1,9 @@
package MyApp;
+use Moose;
+use namespace::autoclean;
-use strict;
-use warnings;
+use Catalyst::Runtime 5.80;
-use Catalyst::Runtime '5.70';
-
# Set flags and add plugins for the application
#
# -Debug: activates the debug mode for very useful log messages
@@ -13,25 +12,25 @@
# Static::Simple: will serve static files from the application's root
# directory
-use parent qw/Catalyst/;
-
-# Load plugins
use Catalyst qw/
- -Debug
- ConfigLoader
- Static::Simple
-
- StackTrace
+ -Debug
+ ConfigLoader
+ Static::Simple
- Authentication
- Authorization::Roles
-
- Session
- Session::Store::FastMmap
- Session::State::Cookie
- /;
+ StackTrace
+ Authentication
+ Authorization::Roles
+
+ Session
+ Session::Store::FastMmap
+ Session::State::Cookie
+/;
+
+extends 'Catalyst';
+
our $VERSION = '0.01';
+$VERSION = eval $VERSION;
# Configure the application.
#
@@ -42,9 +41,11 @@
# with an external configuration file acting as an override for
# local deployment.
-__PACKAGE__->config( name => 'MyApp',
- session => {flash_to_stash => 1}
- );
+__PACKAGE__->config(
+ name => 'MyApp',
+ # Disable deprecated behavior needed by old applications
+ disable_component_resolution_regex_fallback => 1,
+);
# Configure SimpleDB Authentication
__PACKAGE__->config->{'Plugin::Authentication'} = {
@@ -55,7 +56,6 @@
},
};
-
# Start the application
__PACKAGE__->setup();
@@ -76,13 +76,9 @@
L<MyApp::Controller::Root>, L<Catalyst>
-=head1 AUTHOR
-
-root
-
=head1 LICENSE
-This library is free software, you can redistribute it and/or modify
+This library is free software. You can redistribute it and/or modify
it under the same terms as Perl itself.
=cut
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/myapp.conf
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/myapp.conf 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/myapp.conf 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,3 +1,3 @@
-# rename this file to MyApp.yml and put a : in front of "name" if
-# you want to use yaml like in old versions of Catalyst
+# rename this file to myapp.yml and put a ':' after 'name' if
+# you want to use YAML like in old versions of Catalyst
name MyApp
Modified: trunk/examples/Tutorial/MyApp_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-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/myapp01.sql 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,3 +1,4 @@
+PRAGMA foreign_keys = ON;
--
-- Create a very simple database to hold book and author information
--
@@ -8,8 +9,8 @@
);
-- 'book_author' is a many-to-many join table between books & authors
CREATE TABLE book_author (
- book_id INTEGER,
- author_id INTEGER,
+ book_id INTEGER REFERENCES book(id) ON DELETE CASCADE ON UPDATE CASCADE,
+ author_id INTEGER REFERENCES author(id) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (book_id, author_id)
);
CREATE TABLE author (
@@ -41,4 +42,3 @@
INSERT INTO book_author VALUES (4, 6);
INSERT INTO book_author VALUES (4, 7);
INSERT INTO book_author VALUES (5, 8);
-
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/myapp02.sql
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/myapp02.sql 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/myapp02.sql 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,3 +1,4 @@
+PRAGMA foreign_keys = ON;
--
-- Add user and role tables, along with a many-to-many join table
--
@@ -15,8 +16,8 @@
role TEXT
);
CREATE TABLE user_role (
- user_id INTEGER,
- role_id INTEGER,
+ user_id INTEGER REFERENCES user(id) ON DELETE CASCADE ON UPDATE CASCADE,
+ role_id INTEGER REFERENCES role(id) ON DELETE CASCADE ON UPDATE CASCADE,
PRIMARY KEY (user_id, role_id)
);
--
@@ -31,4 +32,3 @@
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-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/root/src/wrapper.tt2 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>[% template.title or "My Catalyst App!" %]</title>
<link rel="stylesheet" href="[% c.uri_for('/static/css/main.css') %]" />
@@ -26,7 +26,7 @@
<div id="content">
[%# Status and error messages %]
- <span class="message">[% status_msg %]</span>
+ <span class="message">[% status_msg %]</span>
<span class="error">[% error_msg %]</span>
[%# This is where TT will stick all of your template's contents. -%]
[% content %]
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/01app.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/01app.t 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/01app.t 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,7 +1,10 @@
+#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More;
BEGIN { use_ok 'Catalyst::Test', 'MyApp' }
ok( request('/')->is_success, 'Request should succeed' );
+
+done_testing();
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/02pod.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/02pod.t 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/02pod.t 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,3 +1,4 @@
+#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/03podcoverage.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/03podcoverage.t 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/03podcoverage.t 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,3 +1,4 @@
+#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/controller_Books.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/controller_Books.t 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/controller_Books.t 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,10 +1,9 @@
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
BEGIN { use_ok 'Catalyst::Test', 'MyApp' }
BEGIN { use_ok 'MyApp::Controller::Books' }
ok( request('/books')->is_success, 'Request should succeed' );
-
-
+done_testing();
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/controller_Login.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/controller_Login.t 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/controller_Login.t 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,10 +1,9 @@
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
BEGIN { use_ok 'Catalyst::Test', 'MyApp' }
BEGIN { use_ok 'MyApp::Controller::Login' }
ok( request('/login')->is_success, 'Request should succeed' );
-
-
+done_testing();
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/controller_Logout.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/controller_Logout.t 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/controller_Logout.t 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,10 +1,9 @@
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More;
BEGIN { use_ok 'Catalyst::Test', 'MyApp' }
BEGIN { use_ok 'MyApp::Controller::Logout' }
ok( request('/logout')->is_success, 'Request should succeed' );
-
-
+done_testing();
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/model_DB.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/model_DB.t 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/model_DB.t 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,6 +1,7 @@
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
BEGIN { use_ok 'MyApp::Model::DB' }
+done_testing();
Modified: trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/view_TT.t
===================================================================
--- trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/view_TT.t 2010-02-07 11:07:18 UTC (rev 12823)
+++ trunk/examples/Tutorial/MyApp_Chapter7/MyApp/t/view_TT.t 2010-02-07 11:29:48 UTC (rev 12824)
@@ -1,6 +1,7 @@
use strict;
use warnings;
-use Test::More tests => 1;
+use Test::More;
BEGIN { use_ok 'MyApp::View::TT' }
+done_testing();
More information about the Catalyst-commits
mailing list