Thanks. I did change the longRunningModule part. The syntax error was in the line: if ($@) { apparently at the end of the line, which I believe usually means opening brackets without closing brackets or vice versa. Fred
Jay Savage <[EMAIL PROTECTED]> wrote: On 1/8/07, hOURS wrote: > Hi everyone, > Jay offered me the following code to help with something. I don't undertand > it, but tried to use it anyway to see if it would work. The computer told me > there was a syntax error in the area I highlighted in color. I can't find it > - maybe that's because I don't understand the code fully, but if anyone can > show me where it is I'd be grateful. > Thanks, > Fred Kittelmann > > Jay Savage wrote:my $timeout = 3600; # 1 hour > eval { > local $SIG{ALRM} = sub { die "longRunningModule timed out\n" }; > alarm $timeout; > require longRunningModule; > alarm 0; > } > > if ($@) { > if ($@ =~ /timed out/) { > # timeout > } else { > # some other error > } > } > > > > Fred Kittelmann Fred, Most people on this list probably don't accept HTML emails from it--I know I don't--so it's unclear what you highlighted in color. My guess, though, is that you don't actually have a perl module named 'longRunningModule'. That's just the placeholder the perldoc uses. you need to replace that with whatever bit of code you're trying to timeout. The code from the perldoc is generic; you need to make it fit your situation. HTH, -- jay -------------------------------------------------- This email and attachment(s): [ ] blogable; [ x ] ask first; [ ] private and confidential daggerquill [at] gmail [dot] com http://www.tuaw.com http://www.downloadsquad.com http://www.engatiki.org values of รข will give rise to dom! __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com