in reply to How to Run a section of code for a particular amount of time ?
The simplest way is just to use time. Something like:
my $end = time + 30; while (time < $end) { ... } [download]