I wanted to put a timeout on the section of code which sends the POST 
request. If after 3 minutes I receieved no response I wanted to exit the program.

I saw some code in "Advanced Perl 
Programming" which uses eval and alarm to achieve this.

...
eval{
    local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required    
    alarm(2);    
    $result = $ua->request($req);
    alarm(0);
};
if ($@) {
    die unless $@ eq "alarm\n";   # propagate unexpected errors
    exit(0);
 }
 else {
     # didn't
 }
...

but the request is blocked and the alarm() is not been exevuted after 2 seconds - why?


Many thanks,stephan


 

_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to