On Sun, Aug 8, 2010 at 15:44, Vimal <vimal7...@gmail.com> wrote:
> Hi Guys,
>
> I am trying to learn modules in Perl.. I was checking the documentation of
> Net::Twitter::Role::OAuth which has text:
>
> ========
> In a web application mode, you need to save the oauth_token and
> oauth_token_secret somewhere when you redirect the user to the OAuth
> authorization
>       URL.
>
>         sub twitter_authorize : Local {
>             my($self, $c) = @_;
>
>             my $nt = Net::Twitter->new(traits => [qw/API::REST OAuth/],
> %param);
>             my $url = $nt->get_authorization_url(callback => $callbackurl);
>
>             $c->response->cookies->{oauth} = {
>                 value => {
>                     token => $nt->request_token,
>                     token_secret => $nt->request_token_secret,
>                 },
>             };
>
>             $c->response->redirect($url);
>         }
> ========
>
> What is $c here? Or more specifically, which module should I load to get
> this line working (some http module I guess, but there are so many of them I
> do not know):
>
> $c->response->redirect($url);
snip

That section is about writing web applications that use
Net::Twitter::Role::OAuth.  Given the use of the [Local][0]
[subroutine attribute][1], I am betting that code is written with
[Catalyst][2] in mind.  In Catalyst, actions receive a [context][3]
variable.  The context variable holds the [request object][4] (holds
information about the request the user made), the [response object[5]
(what you use to send information back to the user), configuration
object (holds your configuration options), the logging object (which
you use to log errors and transactions), and the stash (which you can,
but probably shouldn't, use to hold random information you want to
pass around).

 [0]: 
http://search.cpan.org/dist/Catalyst-Manual/lib/Catalyst/Manual/Intro.pod#Actions
 [1]: http://perldoc.perl.org/perlsub.html#Subroutine-Attributes
 [2]: 
http://search.cpan.org/dist/Catalyst-Manual/lib/Catalyst/Manual/Intro.pod#What_is_Catalyst?
 [3]: 
http://search.cpan.org/dist/Catalyst-Manual/lib/Catalyst/Manual/Intro.pod#Context
 [4]: http://search.cpan.org/dist/Catalyst-Runtime/lib/Catalyst/Request.pm
 [5]: http://search.cpan.org/dist/Catalyst-Runtime/lib/Catalyst/Response.pm

-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to