[Catalyst-commits] r8766 -
Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial
hkclark at dev.catalyst.perl.org
hkclark at dev.catalyst.perl.org
Sat Dec 6 16:21:08 GMT 2008
Author: hkclark
Date: 2008-12-06 16:21:07 +0000 (Sat, 06 Dec 2008)
New Revision: 8766
Modified:
Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/AdvancedCRUD.pod
Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Appendices.pod
Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Authentication.pod
Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Authorization.pod
Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod
Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod
Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Debugging.pod
Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Intro.pod
Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Testing.pod
Log:
Apply some base edits for update to Ubuntu 8.10 & Cat 5.7014
Modified: Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/AdvancedCRUD.pod
===================================================================
--- Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/AdvancedCRUD.pod 2008-12-06 15:52:55 UTC (rev 8765)
+++ Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/AdvancedCRUD.pod 2008-12-06 16:21:07 UTC (rev 8766)
@@ -96,4 +96,4 @@
L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/>.
Copyright 2006-2008, Kennedy Clark, under Creative Commons License
-(L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).
+(L<http://creativecommons.org/licenses/by-sa/3.0/us/>).
Modified: Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Appendices.pod
===================================================================
--- Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Appendices.pod 2008-12-06 15:52:55 UTC (rev 8765)
+++ Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Appendices.pod 2008-12-06 16:21:07 UTC (rev 8766)
@@ -819,4 +819,4 @@
L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/>.
Copyright 2006-2008, Kennedy Clark, under Creative Commons License
-(L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).
+(L<http://creativecommons.org/licenses/by-sa/3.0/us/>).
Modified: Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Authentication.pod
===================================================================
--- Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Authentication.pod 2008-12-06 15:52:55 UTC (rev 8765)
+++ Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Authentication.pod 2008-12-06 16:21:07 UTC (rev 8766)
@@ -880,4 +880,4 @@
L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/>.
Copyright 2006-2008, Kennedy Clark, under Creative Commons License
-(L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).
+(L<http://creativecommons.org/licenses/by-sa/3.0/us/>).
Modified: Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Authorization.pod
===================================================================
--- Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Authorization.pod 2008-12-06 15:52:55 UTC (rev 8765)
+++ Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Authorization.pod 2008-12-06 16:21:07 UTC (rev 8766)
@@ -412,5 +412,5 @@
L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/>.
Copyright 2006-2008, Kennedy Clark, under Creative Commons License
-(L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).
+(L<http://creativecommons.org/licenses/by-sa/3.0/us/>).
Modified: Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod
===================================================================
--- Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod 2008-12-06 15:52:55 UTC (rev 8765)
+++ Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/BasicCRUD.pod 2008-12-06 16:21:07 UTC (rev 8766)
@@ -570,5 +570,5 @@
L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/>.
Copyright 2006-2008, Kennedy Clark, under Creative Commons License
-(L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).
+(L<http://creativecommons.org/licenses/by-sa/3.0/us/>).
Modified: Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod
===================================================================
--- Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod 2008-12-06 15:52:55 UTC (rev 8765)
+++ Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod 2008-12-06 16:21:07 UTC (rev 8766)
@@ -73,7 +73,7 @@
application. Given that many other documents cover this subject in
detail, MVC will not be discussed in depth here (for an excellent
introduction to MVC and general Catalyst concepts, please see
-L<Catalyst::Manual::About|Catalyst::Manual::About>. In short:
+L<Catalyst::Manual::About|Catalyst::Manual::About>). In short:
=over 4
@@ -88,8 +88,8 @@
The view takes model objects and renders them into something for the end
user to look at. Normally this involves a template-generation tool that
creates HTML for the user's web browser, but it could easily be code
-that generates other forms such as PDF documents, e-mails, or Excel
-spreadsheets.
+that generates other forms such as PDF documents, e-mails, spreadsheets,
+or even "behind the scenes" formats such as XML and JSON.
=item * Controller
@@ -138,8 +138,8 @@
directories and files it creates:
Changes # Record of application changes
- lib # Lib directory for Perl modules
- Hello # Application code directory
+ lib # Lib directory for your app's Perl modules
+ Hello # Application main code directory
Controller # Directory for Controller modules
Model # Directory for Models
View # Directory for Views
@@ -183,9 +183,10 @@
$ script/hello_server.pl
[debug] Debug messages enabled
+ [debug] Statistics enabled
[debug] Loaded plugins:
.----------------------------------------------------------------------------.
- | Catalyst::Plugin::ConfigLoader 0.17 |
+ | Catalyst::Plugin::ConfigLoader 0.20 |
| Catalyst::Plugin::Static::Simple 0.20 |
'----------------------------------------------------------------------------'
@@ -208,7 +209,15 @@
| /end | Hello::Controller::Root | end |
'----------------------+--------------------------------------+--------------'
- [info] Hello powered by Catalyst 5.7011
+ [debug] Loaded Path actions:
+ .-------------------------------------+--------------------------------------.
+ | Path | Private |
+ +-------------------------------------+--------------------------------------+
+ | / | /default |
+ | / | /index |
+ '-------------------------------------+--------------------------------------'
+
+ [info] Hello powered by Catalyst 5.7014
You can connect to your server at http://localhost:3000
Point your web browser to
@@ -218,7 +227,7 @@
following should be appended to the logging output of the development
server:
- [info] *** Request 1 (1.000/s) [10301] [Sun May 18 10:11:36 2008] ***
+ [info] *** Request 1 (1.000/s) [10301] [Sun Nov 23 10:11:36 2008] ***
[debug] "GET" request for "/" from "127.0.0.1"
[info] Request took 0.017964s (55.667/s)
.----------------------------------------------------------------+-----------.
@@ -237,14 +246,16 @@
The Root.pm controller is a place to put global actions that usually
execute on the root URL. Open the C<lib/Hello/Controller/Root.pm> file in
-your editor. You will see the "default" subroutine, which is
+your editor. You will see the "index" subroutine, which is
responsible for displaying the welcome screen that you just saw in
your browser. Later on you'll want to change that to something more
-reasonable, such as a "404" message but for now just leave it alone.
+reasonable, such as a "404" message or a redirect, but for now just
+leave it alone.
- sub default :Path :Args {
+ sub index :Path :Args(0) {
my ( $self, $c ) = @_;
-
+
+ # Hello World
$c->response->body( $c->welcome_message );
}
@@ -260,17 +271,17 @@
is a special method that returns the welcome message that you saw in
your browser.
-The ":Path :Args" after the method name are attributes which determine
+The ":Path :Args(0)" after the method name are attributes which determine
which URLs will be dispatched to this method. (Depending on your version of
-Catalyst, it used to say "Private" but using that with default is
-currently deprecated.)
+Catalyst, it used to say "Private" but using that with 'default' or 'index'
+is currently deprecated.)
Some MVC frameworks handle dispatching in a central place. Catalyst,
by policy, prefers to handle URL dispatching with attributes on
controller methods. There is a lot of flexibility in specifying which
URLs to match. This particular method will match all URLs, because it
-doesn't specify the path (nothing comes after "Path"), and will accept
-any number of args (nothing after args).
+doesn't specify the path (nothing comes after "Path"), but will only
+accept a single args because of the ":Args(0)".
The default is to map URLs to controller names, and because of
the way that Perl handles namespaces through package names,
@@ -282,7 +293,6 @@
to the package C<Hello::Controller::Admin::Articles>, and the C<create>
method.
-
Add the following subroutine to your C<lib/Hello/Controller/Root.pm>
file:
@@ -298,13 +308,15 @@
up), and go to L<http://localhost:3000/hello> to
see "Hello, World!"
+
=head2 Hello, World! Using a View and a Template
In the Catalyst world a "View" is not a page of XHTML or a template
designed to present a page to a browser. It is the module that
-determines the type of view--HTML, pdf, XML. For the case of a
-template view (such as the default Toolkit Template) the actual
-templates go under the "root" directory.
+determines the I<type> of view -- HTML, pdf, XML, etc. For the
+thing that generates the I<content> of that view, (such as the
+default Toolkit Template) the actual templates go under the
+"root" directory.
To create a TT view, run:
@@ -324,8 +336,7 @@
method that it inherits from the C<Catalyst::View::TT class>.
Template Toolkit is a very full featured template facility, with
-excellent documentation at
-L<http://template-toolkit.org/>,
+excellent documentation at L<http://template-toolkit.org/>,
but since this is not a TT tutorial, we'll stick to only basic TT
usage here (and explore some of the more common TT features in later
parts of the tutorial).
@@ -403,7 +414,7 @@
Bring up or restart the server. Notice in the server output that
C</site/test> is listed in the Loaded Path actions. Go to
-L<http://localhost:3000/site/test>
+L<http://localhost:3000/site/test> in your browser.
You should see your test.tt file displayed, including the name "John"
that you set in the controller.
@@ -419,4 +430,4 @@
L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/>.
Copyright 2006-2008, Kennedy Clark & Gerda Shank, under Creative Commons License
-(L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).
+(L<http://creativecommons.org/licenses/by-sa/3.0/us/>).
Modified: Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Debugging.pod
===================================================================
--- Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Debugging.pod 2008-12-06 15:52:55 UTC (rev 8765)
+++ Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Debugging.pod 2008-12-06 16:21:07 UTC (rev 8766)
@@ -279,7 +279,7 @@
Check the version of an installed module:
- perl -MModule::Name -e 'print $Module::Name::VERSION;'
+ perl -ME<lt>mod_nameE<gt> -e '"print $E<lt>mod_nameE<gt>::VERSION\n"'
For example:
@@ -305,6 +305,30 @@
=back
+=head1 TT DEBUGGING
+
+If you run into issues during the rendering of your template, it might
+be helpful to enable TT C<DEBUG> options. You can do this in a Catalyst
+environment by adding a C<DEBUG> line to the C<__PACKAGE__->config>
+declaration in C<lib/MyApp/View/TT.pm>:
+
+ __PACKAGE__->config({
+ TEMPLATE_EXTENSION => '.tt2',
+ DEBUG => 'undef',
+ });
+
+There are a variety of options you can use, such as 'undef', 'all',
+'service', 'context', 'parser' and 'provider'. See
+L<Template::Constants> for more information (remove the C<DEBUG_>
+portion of the name shown in the TT docs and convert to lower case
+for use inside Catalyst).
+
+B<NOTE:> B<Please be sure to disable TT debug options before continuing
+with the tutorial> (especially the 'undef' option -- leaving this
+enabled will conflict with several of the conventions used by this
+tutorial to leave some variables undefined on purpose).
+
+
=head1 AUTHOR
Kennedy Clark, C<hkclark at gmail.com>
@@ -314,4 +338,4 @@
L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/>.
Copyright 2006-2008, Kennedy Clark, under Creative Commons License
-(L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).
+(L<http://creativecommons.org/licenses/by-sa/3.0/us/>).
Modified: Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Intro.pod
===================================================================
--- Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Intro.pod 2008-12-06 15:52:55 UTC (rev 8765)
+++ Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Intro.pod 2008-12-06 16:21:07 UTC (rev 8766)
@@ -84,7 +84,7 @@
B<NOTE: You can use any perl-supported OS and environment to run
Catalyst.> It should make little or no difference to Catalyst's
-operation, but this tutorial has been written using Ubuntu 8.04
+operation, but this tutorial has been written using Ubuntu 8.10
because that represents a quick and easy for most people to try out
Catalyst with virtually zero setup time and hassles. See the Catalyst
installation section below for more information.
@@ -188,19 +188,19 @@
=item *
-Ubuntu 8.04 Hardy Heron
+Ubuntu 8.10 (Intrepid Ibex)
=item *
-Catalyst v5.7011
+Catalyst v5.7014
=item *
-Catalyst::Devel v1.03
+Catalyst::Devel v1.07
=item *
-DBIx::Class v0.08008
+DBIx::Class v0.08010
=item *
@@ -215,14 +215,10 @@
=item *
-Catalyst::Plugin::Authentication -- v0.10002
+Catalyst::Plugin::Authentication -- v0.10006
=item *
-Catalyst::Plugin::Authentication::Store::DBIC -- v0.09
-
-=item *
-
Catalyst::Plugin::Authorization::ACL -- v0.08
=item *
@@ -231,23 +227,23 @@
=item *
-Catalyst::Plugin::ConfigLoader -- v0.17
+Catalyst::Plugin::ConfigLoader -- v0.20
=item *
-Catalyst::Plugin::Session -- v0.18
+Catalyst::Plugin::Session -- v0.19
=item *
-Catalyst::Plugin::Session::State::Cookie -- v0.08
+Catalyst::Plugin::Session::State::Cookie -- v0.09
=item *
-Catalyst::Plugin::Session::Store::FastMmap -- v0.03
+Catalyst::Plugin::Session::Store::FastMmap -- v0.05
=item *
-Catalyst::Plugin::StackTrace -- v0.06
+Catalyst::Plugin::StackTrace -- v0.08
=item *
@@ -257,6 +253,14 @@
=item *
+B<NOTE:> You can check the versions you have installed with the
+following command:
+
+ perl -ME<lt>mod_nameE<gt> -e '"print $E<lt>mod_nameE<gt>::VERSION\n"'
+
+For example:
+ perl -MCatalyst::Plugin::StackTrace -e 'print "$Catalyst::Plugin::StackTrace::VERSION\n"'
+
Since the web browser is being used on the same box where Perl and the
Catalyst development server is running, the URL of
C<http://localhost:3000> will be used (the Catalyst development server
@@ -302,7 +306,7 @@
=item *
-Download Ubuntu 8.04 (aka, Hardy Heron) Desktop edition and boot from
+Download Ubuntu 8.10 (aka, Intrepid Ibex) Desktop edition and boot from
the CD and/or image file, select your language, and then "Try Ubuntu
without any changes to your computer."
@@ -427,6 +431,4 @@
L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/>.
Copyright 2006-2008, Kennedy Clark, under Creative Commons License
-(L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).
-
-
+(L<http://creativecommons.org/licenses/by-sa/3.0/us/>).
Modified: Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Testing.pod
===================================================================
--- Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Testing.pod 2008-12-06 15:52:55 UTC (rev 8765)
+++ Catalyst-Manual/5.70/branches/no_ttsite/lib/Catalyst/Manual/Tutorial/Testing.pod 2008-12-06 16:21:07 UTC (rev 8766)
@@ -359,5 +359,5 @@
L<http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Manual/lib/Catalyst/Manual/Tutorial/>.
Copyright 2006-2008, Kennedy Clark, under Creative Commons License
-(L<http://creativecommons.org/licenses/by-nc-sa/2.5/>).
+(L<http://creativecommons.org/licenses/by-sa/3.0/us/>).
More information about the Catalyst-commits
mailing list