From: Tomas Doran Date: Thu, 19 Nov 2009 09:57:28 +0000 (+0000) Subject: Merge 'tutorial_role_updates' into 'trunk' X-Git-Tag: v5.8005~77 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=commitdiff_plain;h=513ae34af19a0b2d71231427093837631b06b5c3;hp=a75d00fb83c6c47d6532ab974d7bd7fd54010362 Merge 'tutorial_role_updates' into 'trunk' r11821@t0mlaptop (orig r11786): wolfman2000 | 2009-11-08 18:31:13 +0000 Attempt to branch out to work on adding stuff to the tutorial. r11854@t0mlaptop (orig r11819): wolfman2000 | 2009-11-14 15:57:25 +0000 Add link to SQLite, ensure they get version 3. r11878@t0mlaptop (orig r11843): wolfman2000 | 2009-11-16 05:43:41 +0000 Fix minor grammatical issue. r11879@t0mlaptop (orig r11844): wolfman2000 | 2009-11-16 05:54:04 +0000 Add links to the databases. Let the users see what we're talking about. r11880@t0mlaptop (orig r11845): wolfman2000 | 2009-11-16 05:55:41 +0000 Out of data? I think out of date is meant here. r11881@t0mlaptop (orig r11846): wolfman2000 | 2009-11-16 05:59:04 +0000 Fix dead link. r11882@t0mlaptop (orig r11847): wolfman2000 | 2009-11-16 06:02:14 +0000 Add link. --- diff --git a/Changes b/Changes index 52d5ee2..f4805fb 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,19 @@ Revision history for Catalyst-Manual +5.8001 15 Nov 2009 + - Update tutorial to match latest prepacked versions in Debian 5 + - Add FormHandler branch (with thanks to gshank!) + - Misc cleanup/freshing up of tutorial. + - Fix indenting issue (with thanks to Kiffin Gish) + - Integrate tome fix branch (with thanks to tome!) + - Add a "negative" test to confirm that test02 does not have an admin create link + - Integrate sqlite3 clarification and link by wolfman2000 from tutorial_role_updates branch + - Fix Pod typos in ::Internals (RT#51488) + - Fix Pod typos in the Cookbook (RT#51466) + - Fix a Test::Pod failure and make Debian happier. + - Typo fixes from garu + - Misc minor and/or typo fixes + 5.8001 06 Oct 2009 - Tutorial - Fix RT #46760 diff --git a/lib/Catalyst/Manual.pm b/lib/Catalyst/Manual.pm index cbb21c2..347ad0b 100644 --- a/lib/Catalyst/Manual.pm +++ b/lib/Catalyst/Manual.pm @@ -6,7 +6,7 @@ package Catalyst::Manual; use strict; use warnings; -our $VERSION = '5.8001'; +our $VERSION = '5.8002'; =head1 NAME diff --git a/lib/Catalyst/Manual/Cookbook.pod b/lib/Catalyst/Manual/Cookbook.pod index 8c46a14..9ae8630 100644 --- a/lib/Catalyst/Manual/Cookbook.pod +++ b/lib/Catalyst/Manual/Cookbook.pod @@ -1339,13 +1339,13 @@ Imagine that you would like the following paths in your application: =over -=item B/track/> +=item B<< /cd//track/ >> Displays info on a particular track. In the case of a multi-volume CD, this is the track sequence. -=item B/volume//track/> +=item B<< /cd//volume//track/ >> Displays info on a track on a specific volume. diff --git a/lib/Catalyst/Manual/Internals.pod b/lib/Catalyst/Manual/Internals.pod index 192d5f4..9263add 100644 --- a/lib/Catalyst/Manual/Internals.pod +++ b/lib/Catalyst/Manual/Internals.pod @@ -20,13 +20,13 @@ Catalyst initializes itself in two stages: =item 1 When the Catalyst module is imported in the main application -module it stores any options. +module, it stores any options. =item 2 -WHen C<< __PACKAGE__->setup >> is called, it evaluates any -options stored (C<-Debug>, C<-Engine=XXX>), makes the application +When C<< __PACKAGE__->setup >> is called, it evaluates any +options stored (C<-Debug>, C<-Engine=XXX>), and makes the application inherit from L (if that hasn't already been done with an explicit C<< use base 'Catalyst'; >> or C<< extends 'Catalyst'; >>. Any specified plugins are then loaded, the application module is made to diff --git a/lib/Catalyst/Manual/Intro.pod b/lib/Catalyst/Manual/Intro.pod index e4d7fda..3f68de1 100644 --- a/lib/Catalyst/Manual/Intro.pod +++ b/lib/Catalyst/Manual/Intro.pod @@ -847,7 +847,7 @@ of the path is passed as arguments. Matches any URL beginning with> http://localhost:3000/my/controller/foo. The namespace and subroutine name together determine the path. -=item * Namespace-level (C<:Global>) +=item * Root-level (C<:Global>) package MyApp::Controller::Foo; sub foo : Global { } @@ -855,8 +855,9 @@ subroutine name together determine the path. Matches http://localhost:3000/foo - that is, the action is mapped directly to the controller namespace, ignoring the function name. -C<:Global> is equivalent C<:Local> one level higher in -the namespace. +C<:Global> always matches from root: it is sugar for C<:Path('/methodname')>. +C<:Local> is simply sugar for C<:Path('methodname')>, which takes the package +namespace as described above. package MyApp::Controller::Root; __PACKAGE__->config->{namespace}=''; @@ -887,7 +888,9 @@ C<:Args(0)> means that no arguments are taken. Thus, the URL and path must match precisely. No :Args at all means that B of arguments are taken. Thus, any -URL that B the controller's path will match. +URL that B the controller's path will match. Obviously, this means +you cannot chain from an action that does not specify args, as the next action +in the chain will be swallowed as an arg to the first! =item * Literal match (C<:Path>) @@ -1311,16 +1314,16 @@ C<< $c->request->args >>. If you don't want or need these features then it's perfectly acceptable (and faster) to do something like this: -sub hello : Global { - my ( $self, $c ) = @_; - $c->stash->{message} = 'Hello World!'; - $self->check_message( $c, 'test1' ); -} - -sub check_message { - my ( $self, $c, $first_argument ) = @_; - # do something... -} + sub hello : Global { + my ( $self, $c ) = @_; + $c->stash->{message} = 'Hello World!'; + $self->check_message( $c, 'test1' ); + } + + sub check_message { + my ( $self, $c, $first_argument ) = @_; + # do something... + } Note that C returns to the calling action and continues processing after the action finishes. If you want all further processing diff --git a/lib/Catalyst/Manual/Tutorial/01_Intro.pod b/lib/Catalyst/Manual/Tutorial/01_Intro.pod index 4147f77..5a9950e 100644 --- a/lib/Catalyst/Manual/Tutorial/01_Intro.pod +++ b/lib/Catalyst/Manual/Tutorial/01_Intro.pod @@ -162,8 +162,8 @@ by DBIx::Class.) =item * -The use of L for automated form processing -and validation. +The use of L or L +for automated form processing and validation. =back @@ -203,11 +203,11 @@ Catalyst v5.80013 =item * -Catalyst::Devel v1.15 +Catalyst::Devel v1.21 =item * -DBIx::Class v0.08108 +DBIx::Class v0.08112 =item * @@ -226,7 +226,7 @@ use. This tutorial has been tested against the following set of plugins: =item * -Catalyst::Plugin::Authentication -- v0.10011 +Catalyst::Plugin::Authentication -- v0.10015 =item * @@ -234,27 +234,27 @@ Catalyst::Plugin::Authorization::Roles -- v0.07 =item * -Catalyst::Plugin::ConfigLoader -- v0.23 +Catalyst::Plugin::ConfigLoader -- v0.27 =item * -Catalyst::Plugin::Session -- v0.22 +Catalyst::Plugin::Session -- v0.29 =item * -Catalyst::Plugin::Session::State::Cookie -- v0.11 +Catalyst::Plugin::Session::State::Cookie -- v0.17 =item * -Catalyst::Plugin::Session::Store::FastMmap -- v0.10 +Catalyst::Plugin::Session::Store::FastMmap -- v0.13 =item * -Catalyst::Plugin::StackTrace -- v0.10 +Catalyst::Plugin::StackTrace -- v0.11 =item * -Catalyst::Plugin::Static::Simple -- v0.21 +Catalyst::Plugin::Static::Simple -- v0.25 =back @@ -402,7 +402,8 @@ Install Catalyst: sudo aptitude -y install sqlite3 libdbd-sqlite3-perl libcatalyst-perl \ libcatalyst-modules-perl libdbix-class-timestamp-perl \ libdbix-class-encodedcolumn-perl libperl6-junction-perl \ - libdatetime-format-sqlite-perl + libdatetime-format-sqlite-perl libconfig-general-perl \ + libhtml-formfu-model-dbic-perl Let it install (normally about a 30 to 90-second operaton) and you are done. (Note the '\' above. Depending on your environment, you might diff --git a/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod b/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod index 27f1dcd..06e4986 100644 --- a/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod +++ b/lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod @@ -193,8 +193,8 @@ previous step): [debug] Statistics enabled [debug] Loaded plugins: .----------------------------------------------------------------------------. - | Catalyst::Plugin::ConfigLoader 0.23 | - | Catalyst::Plugin::Static::Simple 0.21 | + | Catalyst::Plugin::ConfigLoader 0.27 | + | Catalyst::Plugin::Static::Simple 0.25 | '----------------------------------------------------------------------------' [debug] Loaded dispatcher "Catalyst::Dispatcher" diff --git a/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod b/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod index 38497af..904959c 100644 --- a/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod +++ b/lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod @@ -560,6 +560,9 @@ tutorial. =head1 CREATE A SQLITE DATABASE In this step, we make a text file with the required SQL commands to +create a database table and load some sample data. We will use +SQLite (L), a popular database that is +lightweight and easy to use. Be sure to get at least version 3. Open create a database table and load some sample data. We will use L, a popular database that is lightweight and easy to use. Be sure to get at least version 3. Open @@ -649,13 +652,13 @@ required if you do a single SQL statement on the command line). Use your OS command prompt. Please note that here we have chosen to use 'singular' table names. This -is because the default inflection code for L +is because the default inflection code for L does NOT handle plurals. There has been much philosophical discussion on whether table names should be plural or singular. There is no one correct answer, as long as one makes a choice and remains consistent with it. If you prefer plural table names (e.g. they are easier and more natural to read) then you will need to pass it an inflect_map -option. See L for more information. +option. See L for more information. For using other databases, such as PostgreSQL or MySQL, see L. @@ -691,20 +694,20 @@ running this command: $ perl -MCatalyst::Model::DBIC::Schema -e \ 'print "$Catalyst::Model::DBIC::Schema::VERSION\n"' - 0.23 + 0.31 Please note the '\' above. Depending on your environment, you might be able to cut and paste the text as shown or need to remove the '\' character to that the command is all on a single line. -You should have version 0.23 or greater if you are following along +You should have version 0.31 or greater if you are following along with Debian 5. In other environments, you may need to run this command to install it directly from CPAN: $ sudo cpan Catalyst::Model::DBIC::Schema And re-run the version print command to verify that you are now at -0.23 or higher. +0.31 or higher. =head2 Create Static DBIx::Class Schema Files @@ -755,11 +758,6 @@ into files. =item * -C causes the help to include the -L DBIC component. - -=item * - And finally, C is the standard DBI connect string for use with SQLite. @@ -907,9 +905,9 @@ display something like: [debug] Statistics enabled [debug] Loaded plugins: .----------------------------------------------------------------------------. - | Catalyst::Plugin::ConfigLoader 0.22 | - | Catalyst::Plugin::StackTrace 0.09 | - | Catalyst::Plugin::Static::Simple 0.21 | + | Catalyst::Plugin::ConfigLoader 0.27 | + | Catalyst::Plugin::StackTrace 0.11 | + | Catalyst::Plugin::Static::Simple 0.25 | '----------------------------------------------------------------------------' [debug] Loaded dispatcher "Catalyst::Dispatcher" @@ -950,7 +948,7 @@ display something like: | /books/list | /books/list | '-------------------------------------+--------------------------------------' - [info] MyApp powered by Catalyst 5.80003 + [info] MyApp powered by Catalyst 5.80013 You can connect to your server at http://debian:3000 B Be sure you run the C