Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Thread::Queue and WWW::Curl

by BrowserUk (Pope)
on Sep 24, 2012 at 14:42 UTC ( #995401=note: print w/ replies, xml ) Need Help??


in reply to Thread::Queue and WWW::Curl

My problem is the subroutine with those WWW::Curl:: calls returns at the line that posts the form: my $response = $curl->perform;

Is that a problem description? Because I cannot see where it says something fails, much less what; how; what error mesages/code you get.

the deleteUser subroutine calls another which contains use WWW::Curl::Easy; use WWW::Curl::Form;

That kind of implies that the code that is failing is in the subroutines that you haven't bothered to post. Is that the case?


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

RIP Neil Armstrong

network sites:


Comment on Re: Thread::Queue and WWW::Curl
Re^2: Thread::Queue and WWW::Curl
by Anonymous Monk on Sep 24, 2012 at 14:53 UTC

    Thanks for the speedy replies. The 2 missing subroutines are as follows:

    sub deleteUser { # in: app access token, app id, FB userId to delete # deletes user using app access token # out: nothing my ($accessToken, $appId, $userId) = (shift, shift, shift); my %form = ( method => 'delete', access_token => $accessToken ); my $url = 'https://graph.facebook.com/' . $userId; my $post = hitFbNew2('post', $url , \%form); return ($post); }
    and
    sub hitFbNew { my ($method, $endpoint, $form) = (shift, shift, shift); my $curl = WWW::Curl::Easy->new; my $curlf = WWW::Curl::Form->new; my $response_body; for my $key (keys %{$form}){ $curlf->formadd($key, $form->{$key}); } $curl->setopt(CURLOPT_WRITEDATA, \$response_body); $curl->setopt(CURLOPT_URL, $endpoint); $curl->setopt(CURLOPT_HTTPPOST, $curlf); print "\nHitting FB using the curl libraries..."; my $response = $curl->perform; print "\nresponse was $response"; my %reply = ( content => $response_body, responseCode => $curl->getinfo(CURLINFO_HTTP_CODE) ); print "\nreply code is $reply{responseCode} and content is $reply{co +ntent}"; return (\%reply); }
    I will look at WWW::Curl::Multi in the meantime.

      You still haven't said what fails? Or how you know something is failing?


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

      RIP Neil Armstrong

        When I run via threads, the following line does not output to my terminal:

        print "\nresponse was $response";
        , nor does the print statement after it output; furthermore I don't see the user deleted on the remote server when running via threads (however I do when running that code without threading).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2014-07-28 21:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (210 votes), past polls