codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  How to time out an operation?  mimir at 16:31 on Saturday, March 22, 2008
 

#Im trying to time out an operation...

#the books say it should be done with the following method:

$SIG{ALRM} = sub { die "Timeout" };
eval
{
alarm 3;
chomp($answer = <STDIN>);
alarm 0;
};




#####
but... in my system, when alarm 3 gets execute, the eval function is quitted.
so the timeout never takes place.

also... when i type alarm 3; into a script and its not inside eval{...} then i get an error.
the books claim one should not get an error and im not finding out why the error comes up.

How does one time out an operation?

  Re: How to time out an operation?  mimir at 09:47 on Sunday, April 06, 2008
 

alarm doesn't work in perl 5.6

i think it only works in perl 5.8 and up.










CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
• mkdirs
• Re: Web Development Project
• ** Site Hacked ** javascript inserted...
• Losing background/text color when converting HTML to PDF
• hidden div block when displayed, displays at an offset of 200px only in IE 6..
• help - sketch
• Re: Perl Script - File Handling.
• Open a file from website
• Re: to open 5 terminals from one and also execute different commands on each terminal


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008