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.