X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Manual.git;a=blobdiff_plain;f=lib%2FCatalyst%2FManual%2FExtendingCatalyst.pod;h=73af1bd86f4af33cc6987c8d0d315d44c69db6a7;hp=b1a282c9114b9c2b66373ae26b030b10c24478f5;hb=429d1caf111575afa4c25287cc48d7ed712af327;hpb=400fa4c386386ff8ea5dd4195895eafb6ea5c84d diff --git a/lib/Catalyst/Manual/ExtendingCatalyst.pod b/lib/Catalyst/Manual/ExtendingCatalyst.pod index b1a282c..73af1bd 100644 --- a/lib/Catalyst/Manual/ExtendingCatalyst.pod +++ b/lib/Catalyst/Manual/ExtendingCatalyst.pod @@ -238,12 +238,12 @@ array reference. As you can see, you can use attributes to configure your actions. You can specify or alter these attributes via L, or even react on them as soon as Catalyst encounters them by providing your own L. +class|/"Component base classes">. =head2 Component Configuration At creation time, the class configuration of your component (the one -available via C<$self-Econfig>) will be merged with possible +available via C<< $self->config >>) will be merged with possible configuration settings from the applications configuration (either directly or via config file). This is done by Catalyst, and the correctly merged configuration is passed to your component's @@ -312,10 +312,10 @@ method. The execute method of the action will naturally call the methods code. You can surround this by overriding the method in a subclass: - package Catalyst::Action::MyFoo; + package Catalyst::Action::MyFoo; use Moose; use namespace::autoclean; - use MRO::Compat; + use MRO::Compat; extends 'Catalyst::Action'; sub execute { @@ -329,12 +329,12 @@ subclass: 1; We are using L to ensure that you have the next::method -call, from L (in older perls), or natively (if you are using -perl 5.10) to re-dispatch to the original C method in the +call, from L (in older perls), or natively (if you are using +perl 5.10) to re-dispatch to the original C method in the L class. The Catalyst dispatcher handles an incoming request and, depending -upon the dispatch type, will call the appropriate target or chain. +upon the dispatch type, will call the appropriate target or chain. From time to time it asks the actions themselves, or through the controller, if they would match the current request. That's what the C method does. So by overriding this, you can change on what @@ -343,7 +343,7 @@ the action will match and add new matching criteria. For example, the action class below will make the action only match on Mondays: - package Catalyst::Action::OnlyMondays; + package Catalyst::Action::OnlyMondays; use Moose; use namespace::autoclean; use MRO::Compat; @@ -466,7 +466,7 @@ with some custom actions by sub-classing it: package MyApp::Controller::Foo; use Moose; use namespace::autoclean; - + BEGIN { extends 'MyApp::Base::Controller::ModelBase'; } __PACKAGE__->config( model_name => 'DB::Foo', @@ -537,7 +537,7 @@ Here is some example code for a fictional view: package Catalyst::View::MyView; use Moose; use namespace::autoclean; - + extends 'Catalyst::View'; sub process { @@ -637,7 +637,7 @@ A simple example like this is actually better as a L role, for example: if (!blessed($_[0]) || !$_[0]->isa('Catalyst::Action')); return $uri; }; - + Note that Catalyst will load any Moose Roles in the plugin list, and apply them to your application class. @@ -660,13 +660,13 @@ Here is a stub C method: package CatalystX::Component::Foo; use Moose; use namespace::autoclean; - + extends 'Catalyst::Component'; sub COMPONENT { my $class = shift; # Note: $app is like $c, but since the application isn't fully - # initialized, we don't want to call it $c yet. $config + # initialized, we don't want to call it $c yet. $config # is a hashref of config options possibly set on this component. my ($app, $config) = @_;