|
Posted by Joost Diepenmaat on February 6, 2008, 3:47 pm
Please log in for more thread options
alx__21@hotmail.com writes:
> Hi,
>
> I'm looking for something that is like eval in that it can compile and
> run code from strings, but will quit after a maximum given time.
>
> The benchmark module tool "timethis" is very close, but it can only
> ever specify a minimum time to iterate the given code. What I want is
> code that iterates ONCE, breaking at a maximum time that I can specify
> (if it runs that long).
>
> If anybody knows of a function to do this I would appreciate it. I
> would rather not have to start digging around in the source for
> timethis to create my own.
>
> Thanks.
See perldoc -f alarm, but note that your code may still block on IO, as
far as I know, if your perl was build with "safe signals" - the default
for a few years now.
Joost.
|