Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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?

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
[Cosmic37]: hey erix are you there? earlier you said that one should check whether neural networks actually work... did you have a bad experience with neuralnetworks?

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2018-02-20 19:52 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (274 votes). Check out past polls.