X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FTutorial%2FMoreCatalystBasics.pod;h=1c2086a074bd2da95a861df704a1977656a191cd;hp=edc0ddd1b2621c29d7efa4471875812a02bcabbc;hb=feb4555a077523ed0583fa59e9f4ff843d5ae026;hpb=de966eb4075222a38bf5954b9527ef89c90bbb2e diff --git a/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod b/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod index edc0ddd..1c2086a 100644 --- a/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod +++ b/lib/Catalyst/Manual/Tutorial/MoreCatalystBasics.pod @@ -140,20 +140,21 @@ very similar to Apache configuration files. We will see how to use this feature of Catalyst during the authentication and authorization sections (Part 5 and Part 6). -B If you are using a version of -L prior to version 1.06, you need to -be aware that Catalyst changed from a default format of YAML to the -more straightforward C format. This tutorial use the -newer C configuration file for C instead -of C for YAML. However, Catalyst has long supported both -formats and Catalyst will automatically use either C or -C (or any other format supported by -L and -L). If you are using a versions of -Catalyst::Devel prior to 1.06, you can convert to the newer format by -simply creating the C file manually and deleting -C. The default contents of C should only -consist of one line: C. +B If you are using a version of +L prior to version 1.06, be aware +that Catalyst changed the default format from YAML to the more +straightforward C style. This tutorial uses the +newer C file for C. However, Catalyst +supports both formats and will automatically use either C +or C (or any other format supported by +L and +L). If you are using a version of +Catalyst::Devel prior to 1.06, you can convert to the newer format by +simply creating the C file manually and deleting +C. The default contents of the C you create +should only consist of one line: + + name MyApp B: This script can be useful for converting between configuration formats: @@ -161,10 +162,6 @@ formats: perl -Ilib -e 'use MyApp; use Config::General; Config::General->new->save_file("myapp.conf", MyApp->config);' -B The default C should look like: - - name MyApp - =item * L @@ -294,26 +291,89 @@ Context object is automatically passed to all Catalyst components. It is used to pass information between components and provide access to Catalyst and plugin functionality. -B Catalyst actions are regular Perl methods, but they make use -of Nicholas Clark's C module (that's the "C<: Local>" next -to the C in the code above) to provide additional -information to the Catalyst dispatcher logic. Many newer Catalyst -applications are switching to the use of "Literal" C<:Path> actions -and C attribute in lieu of C<: Local> and C<: Private>. For -example, C can be used instead of C (because no path was supplied to C it matches -the "empty" URL in the namespace of that module... the same thing -C would do) or C could be -used instead of the C above (the C argument to -C would make it match on the URL C under C, the -namespace of the current module). See "Action Types" in -L as well as Part 5 -of this tutorial (Authentication) for additional information. Another -popular but more advanced feature is C actions that allow a -single URL to "chain together" multiple action method calls, each with -an appropriate number of arguments (see -L for -details). +Catalyst actions are regular Perl methods, but they make use of +attributes (the "C<: Local>" next to the "C" in the code +above) to provide additional information to the Catalyst dispatcher +logic (note that the space between the colon and the attribute name is +optional... you will see attributes written both ways). Most Catalyst +Controllers use one of five action types: + +=over 4 + +=item * + +B<:Private> -- Use C<:Private> for methods that you want to make into +an action, but you do not want Catalyst to directly expose the action +to your users. Catalyst will not map C<:Private> methods to a URI. +Use them for various sorts of "special" methods (the C, +C, etc. discussed below) or for methods you want to be able to +C or C to. (If the method is a plain old "helper +method" that you don't want to be an action at all, then just define +the method without any attribute -- you can call it in your code, but +the Catalyst dispatcher will ignore it.) + +There are five types of "special" build-in C<:Private> actions: +C, C, C, C, and C. + +=over 4 + +=item * + +With C, C, C, C private actions, only the +most specific action of each type will be called. For example, if you +define a C action in your controller it will I a +C action in your application/root controller -- I the +action in your controller will be called. + +=item * + +Unlike the other actions where only a single method is called for each +request, I auto action along the chain of namespaces will be +called. Each C action will be called I. + +=back + +=item * + +B<:Path> -- C<:Path> actions let you map a method to an explicit URI +path. For example, "C<:Path('list')>" in +C would match on the URL +C but "C<:Path('/list')>" would match +on C. You can use C<:Args()> to specify +how many arguments an action should except. See +L for more information and a few +examples. + +=item * + +B<:Local> -- C<:Local> is merely a shorthand for +"C<:Path('_name_of_method_')>". For example, these are equivalent: +"C" and +"C". + +=item * + +B<:Global> -- C<:Global> is merely a shorthand for +"C<:Path('/_name_of_method_')>". For example, these are equivalent: +"C" and +"C". + +=item * + +B<:Chained> -- Newer Catalyst applications tend to use the Chained +dispatch form of action types because of its power and flexibility. +It allows a series of controller methods to automatically be dispatched +to service a single user request. See +L +and L +for more information on chained actions. + +=back + +You should refer to L for +additional information and for coverage of some lesser-used action +types not discussed here (C and C). =head1 CATALYST VIEWS @@ -569,6 +629,8 @@ required if you do a single SQL statement on the command line). Use ".q" to exit from SQLite from the SQLite interactive mode and return to your OS command prompt. +For using other databases, such as PostgreSQL or MySQL, see +L. =head1 DATABASE ACCESS WITH C @@ -599,19 +661,37 @@ starts: created "/home/me/MyApp/script/../t/model_DB.t" +The C