Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

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 = $browser.post('https://github.com/login/oauth/access_token' +, [ 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);

    Issues
  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?


In reply to LWP::UserAgent::post gives me an odd response by gideondsouza

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (8)
    As of 2014-08-23 08:42 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      The best computer themed movie is:











      Results (172 votes), past polls