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

Re^2: WWW::Curl pause conflict

by krmx (Novice)
on Sep 21, 2015 at 06:38 UTC ( [id://1142598]=note: print w/replies, xml ) Need Help??


in reply to Re: WWW::Curl pause conflict
in thread WWW::Curl pause conflict

Additional: I was wrong - using sleep instead of pause does not work. there is no difference whatsoever between:
while (1) { my $url = "http://kronometrix.org/"; $http->setopt(CURLOPT_URL, $url); my $retcode = $http->perform(); ## Get the results my $response = $http->getinfo(CURLINFO_HTTP_CODE); if ($retcode == 0) { print "Ok, Status: $response\n"; } else { print "Error, Status: $response\n"; } ### Check for end last if ++$loop == $loop_max; ### Interval pause; }
and
while (1) { my $url = "http://kronometrix.org/"; $http->setopt(CURLOPT_URL, $url); my $retcode = $http->perform(); ## Get the results my $response = $http->getinfo(CURLINFO_HTTP_CODE); if ($retcode == 0) { print "Ok, Status: $response\n"; } else { print "Error, Status: $response\n"; } ### Check for end last if ++$loop == $loop_max; ### Interval sleep; }
The code gets stuck after 2 run samples. Always 2 . not sure why. It seems to me something between WWW::Culr (libcurl) and perl regarding alarms and timers.

Replies are listed 'Best First'.
Re^3: WWW::Curl pause conflict
by Anonymous Monk on Sep 21, 2015 at 07:00 UTC
      Thanks for pointers. It seems related the way libcurl handles signal handlers within. I have played around by setting: CURLOPT_NOSIGNAL used to disable the timeouts while the name resolve takes place.
      $http->setopt(CURLOPT_NOSIGNAL, 1); while (1) { my stuff here ... ### Interval pause; }
      http://curl.haxx.se/libcurl/c/CURLOPT_NOSIGNAL.html This might not be smart if I really need to timeout, I think in for some reasons DNS calls are not functioning. I need to think.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-23 07:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found