[Catalyst-commits] r7895 - / trunk/Catalyst-Manual/lib/Catalyst/Manual

zarquon at dev.catalyst.perl.org zarquon at dev.catalyst.perl.org
Thu Jun 5 14:14:11 BST 2008


Author: zarquon
Date: 2008-06-05 14:14:11 +0100 (Thu, 05 Jun 2008)
New Revision: 7895

Modified:
   /
   trunk/Catalyst-Manual/lib/Catalyst/Manual/Cookbook.pod
   trunk/Catalyst-Manual/lib/Catalyst/Manual/Intro.pod
Log:
 r13390 at zaphod:  kd | 2008-06-05 23:13:29 +1000
 moving to use parent stuff for docs



Property changes on: 
___________________________________________________________________
Name: svk:merge
   - 1b129c88-ebf4-0310-add9-f09427935aba:/local/catalyst:4278
1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst:13386
3b9770f9-e80c-0410-a7de-cd203d167417:/local/catalyst:3514
dd8ad9ea-0304-0410-a433-df5f223e7bc0:/local/Catalyst:6909
   + 1b129c88-ebf4-0310-add9-f09427935aba:/local/catalyst:4278
1c72fc7c-9ce4-42af-bf25-3bfe470ff1e8:/local/Catalyst:13390
3b9770f9-e80c-0410-a7de-cd203d167417:/local/catalyst:3514
dd8ad9ea-0304-0410-a433-df5f223e7bc0:/local/Catalyst:6909

Modified: trunk/Catalyst-Manual/lib/Catalyst/Manual/Cookbook.pod
===================================================================
--- trunk/Catalyst-Manual/lib/Catalyst/Manual/Cookbook.pod	2008-06-05 12:10:44 UTC (rev 7894)
+++ trunk/Catalyst-Manual/lib/Catalyst/Manual/Cookbook.pod	2008-06-05 13:14:11 UTC (rev 7895)
@@ -62,10 +62,11 @@
 =head2 Enable debug status in the environment
 
 Normally you enable the debugging info by adding the C<-Debug> flag to
-your C<use Catalyst> statement. However, you can also enable it using
-environment variable, so you can (for example) get debug info without
-modifying your application scripts. Just set C<CATALYST_DEBUG> or
-C<E<lt>MYAPPE<gt>_DEBUG> to a true value.
+your C<use Catalyst> statement (or C<__PACKAGE__->setup(qw/-Debug/)
+). However, you can also enable it using environment variable, so you
+can (for example) get debug info without modifying your application
+scripts. Just set C<CATALYST_DEBUG> or C<E<lt>MYAPPE<gt>_DEBUG> to a
+true value.
 
 =head2 Sessions
 
@@ -112,11 +113,12 @@
 
 =head3 EXAMPLE
 
-  use Catalyst qw/
-                 Session
-                 Session::Store::FastMmap
-                 Session::State::Cookie
-                 /;
+  use parent qw/Catalyst/;
+  __PACKAGE__->setup( qw/
+                         Session
+                         Session::Store::FastMmap
+                         Session::State::Cookie
+                   /;)
 
 
   ## Write data into the session
@@ -266,12 +268,13 @@
 The L<Catalyst::Plugin::Authorization::Roles> plugin is required when
 implementing roles:
 
- use Catalyst qw/
-    Authentication
-    Authentication::Credential::Password
-    Authentication::Store::Htpasswd
-    Authorization::Roles
-  /;
+ use parent qw/Catalyst/;
+ __PACKAGE__->setup (qw/
+     Authentication
+     Authentication::Credential::Password
+     Authentication::Store::Htpasswd
+     Authorization::Roles
+  /);
 
 Roles are implemented automatically when using
 L<Catalyst::Authentication::Store::Htpasswd>:
@@ -400,10 +403,11 @@
 
 =head3 EXAMPLE
 
- use Catalyst qw/Authentication
-                 Authentication::Credential::Password
-                 Authentication::Store::Htpasswd
-                 Authorization::Roles/;
+ use parent qw/Catalyst/;
+ __PACKAGE__->setup( qw/Authentication
+                        Authentication::Credential::Password
+                        Authentication::Store::Htpasswd
+                        Authorization::Roles/);
 
  __PACKAGE__->config->{authentication}{htpasswd} = "passwdfile";
 
@@ -496,10 +500,11 @@
 The Authorization::Roles plugin let's us perform role based access
 control checks. Let's load it:
 
-    use Catalyst qw/
+    use parent qw/Catalyst/;
+    __PACKAGE__->setup(qw/
         Authentication # yadda yadda
         Authorization::Roles
-    /;
+    /);
 
 And now our action should look like this:
 
@@ -713,7 +718,7 @@
 
 3. Add the XMLRPC plugin to MyApp.pm
 
-    use Catalyst qw/-Debug Static::Simple XMLRPC/;
+    __PACKAGE__->setup( qw/-Debug Static::Simple XMLRPC/);
 
 4. Add an API controller
 
@@ -1898,7 +1903,7 @@
 
 Using the plugin is as simple as setting your use line in MyApp.pm to include:
 
- use Catalyst qw/Static::Simple/;
+ __PACKAGE__->setup( qw/Static::Simple/);
 
 and already files will be served.
 
@@ -1983,7 +1988,7 @@
 
 In your main application class (MyApp.pm), load the plugin:
 
-    use Catalyst qw/-Debug FormValidator Static OtherPlugin/;
+    __PACKAGE__->setup( qw/-Debug FormValidator Static OtherPlugin/);
 
 You will also need to make sure your end method does I<not> forward
 static content to the view, perhaps like this:
@@ -2093,12 +2098,12 @@
 Cache::FastMmap, Cache::FileCache, and Cache::Memcached.  These can be
 used to cache the result of slow operations.
 
-This very page you're viewing makes use of the FileCache plugin to cache the
+The Catalyst Advent Calendar uses the FileCache plugin to cache the
 rendered XHTML version of the source POD document.  This is an ideal
-application for a cache because the source document changes infrequently but
-may be viewed many times.
+application for a cache because the source document changes
+infrequently but may be viewed many times.
 
-    use Catalyst qw/Cache::FileCache/;
+    __PACKAGE__->setup( qw/Cache::FileCache/);
     
     ...
     
@@ -2146,7 +2151,7 @@
 
 We can add the PageCache plugin to speed things up.
 
-    use Catalyst qw/Cache::FileCache PageCache/;
+    __PACKAGE__->setup( qw/Cache::FileCache PageCache/);
     
     sub front_page : Path ('/') {
         my ( $self, $c ) = @_;

Modified: trunk/Catalyst-Manual/lib/Catalyst/Manual/Intro.pod
===================================================================
--- trunk/Catalyst-Manual/lib/Catalyst/Manual/Intro.pod	2008-06-05 12:10:44 UTC (rev 7894)
+++ trunk/Catalyst-Manual/lib/Catalyst/Manual/Intro.pod	2008-06-05 13:14:11 UTC (rev 7895)
@@ -560,9 +560,10 @@
     package MyApp;
 
     use strict;
-    use Catalyst qw/-Debug/; # Add other plugins here, e.g.
-                             # for session support
-
+    use parent qw/Catalyst/;
+    __PACKAGE__->setup(qw/-Debug ConfigLoader Static::Simple/);
+    # note you can still use use Catalyst qw/@plugins/ instead of the
+    # above two lines
     MyApp->config(
         name => 'My Application',
 




More information about the Catalyst-commits mailing list