Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

LWP::UserAgent::post gives me an odd response

by gideondsouza (Pilgrim)
on Dec 29, 2012 at 12:54 UTC ( #1010814=perlquestion: print w/ replies, xml ) Need Help??
gideondsouza has asked for the wisdom of the Perl Monks concerning the following question:

So I'm doing a POST request to github as part of an OAuth web flow authentication. (This is part of a sub in a Dancer app).

I use LWP::UserAgent::post() and the docs I linked to seem to say that method will return a HTTP::Response object. But I get a weird type.

When I send a post to github for the access_token is where I have a slight problemo:

my $code = params->{'code'}; my $browser = LWP::UserAgent->new; my $resp = $'' +, [ client_id =>'<my client id>' client_secret => '<my secret>', code => $code,#the code I got in the param state => '<some state>' ]); #HERE>>>>>>>>>>>>>>>>>>>> # I cannot seem to figure what $resp is!?? #----- $resp->is_success doesn't work! return Dumper($resp);

  1. If I use $resp->is_success then I get Can't locate object method "is_success"
  2. With the Data::Dumper I get the following response: $VAR1 = 'LWP::UserAgent=HASH(0x7fd8da50a690)Dancer::Route=HASH(0x7fd8da4dd6a8)';
Any ideas?? How should I go an inspect the object that is returned.? Am I getting two objects here?

Comment on LWP::UserAgent::post gives me an odd response
Download Code
Replies are listed 'Best First'.
Re: LWP::UserAgent::post gives me an odd response
by gideondsouza (Pilgrim) on Dec 29, 2012 at 13:08 UTC

    Dear Monks!

    I'm very sorry about this, seems all this nonsense was caused just because of this:

    Instead of
    :S Seems I've got a lot of practising to do!! Sorry for the trouble again!!
      No need to apologize - particularly in a case where the syntax is not caught by the interpreter.

      You get ++ for self correction.

                   "By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest."           -Confucius

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1010814]
Approved by Corion
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2015-11-26 17:35 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (705 votes), past polls