Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: What is the $c variable?

by Athanasius (Archbishop)
on Nov 01, 2016 at 03:55 UTC ( [id://1175037]=note: print w/replies, xml ) Need Help??


in reply to What is the $c variable?

Hello alwynpan, and welcome to the Monastery!

I’ve never used Catalyst, but looking through the documentation I found this in Catalyst::Manual::Tutorial::02_CatalystBasics:

sub index :Path :Args(0) { my ( $self, $c ) = @_; # Hello World $c->response->body( $c->welcome_message ); }

...

The "$c" here refers to the Catalyst context, which is used to access the Catalyst application. In addition to many other things, the Catalyst context provides access to "response" and "request" objects. (See Catalyst::Runtime, Catalyst::Response, and Catalyst::Request)

No doubt the other monks will be able to provide a fuller explanation. In the meantime, hope that helps,

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: What is the $c variable?
by alwynpan (Acolyte) on Nov 01, 2016 at 04:30 UTC
    Hi Athanasius, Thank you for your help. You are correct, it is actually explained in a later section of the document on CPAN. I found the intro document for Catalyst was not quite well organized as it introduced many new things without any explanation or reference. And the explanation was provided in a later chapter which makes the beginners (at least myself) quite lost. Regards, Alwyn
      If this is your second day in the Perl world, I would suggest that trying to work with the Catalyst framework is probably premature. I think that you should nail down the basics of Perl before going into Catalyst or any other similar large-scale framework. Otherwise, you're going to make the learning curve much steeper than it needs to be.

      IMHO, you should grab a good tutorial or introductory book on Perl (e.g. Learning Perl), get a good understanding on the basic concepts and syntax, spend a couple of weeks on that, and come back to Catalyst afterwards.

      Update: fixed a typo: s/leaning/learning/;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1175037]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-03-29 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found