Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

WritingPlugins doc is wrong?

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


ktat at kawachi

Jun 10, 2006, 10:18 AM

Post #1 of 2 (601 views)
Permalink
WritingPlugins doc is wrong?

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.

Thanks.

--
Kato Atsushi (Ktat)
mailto:atusi [at] pure
mailto:ktat [at] kawachi

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


dbix-class at trout

Jun 10, 2006, 12:03 PM

Post #2 of 2 (516 views)
Permalink
Re: WritingPlugins doc is wrong? [In reply to]

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/ +

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.