[Catalyst] WritingPlugins doc is wrong?

Matt S Trout dbix-class at trout.me.uk
Sat Jun 10 21:03:05 CEST 2006


Ktat wrote:
> I read Catalyst::Manual::WritngPlugins and found following.
> 
> http://search.cpan.org/~agrundma/Catalyst-5.6902/lib/Catalyst/Manual/WritingPlugins.pod
> The code in EXAMPLE is following.
> =====================================================================
>   sub prepare {
>       my $class = shift;
> 
>       # Turns the engine-specific request into a Catalyst context .
>       my $c = $class->NEXT::prepare( @_ );
> =====================================================================
> 
> explanation after the code is following
> =====================================================================
>     sub prepare {
> 
> These methods are called without attributes (Private, Local, etc.).
> 
>     my $c = shift;
> 
> We get the context object for this request as the first argument.
> Hint!:Be sure you shift the context object out of @_ in this. If you just do a
> =====================================================================
> 
> In the code, argument passed to prepare is Class name.
> In the explanation, argument passed to prepare is context object.
> 
> I thnk example is right, arguments of prepare is Class name.

Right, but because the application config, plugins etc. are all classdata, the 
class name is often passed to act as the *application* context, hence it often 
being treated as $c. One of the targets for 5.80 is hopefully to split these 
properly so application is an instance in its own right rather than a class.

-- 
      Matt S Trout       Offering custom development, consultancy and support
   Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list