----Original Message----- From: Chas. Owens [mailto:chas.ow...@gmail.com] Sent: Friday, August 20, 2010 4:07 PM To: Kammen van, Marco, Springer SBM NL Cc: beginners@perl.org Subject: Re: test contents of variable using alarm()
On Fri, Aug 20, 2010 at 04:34, Kammen van, Marco, Springer SBM NL <marco.vankam...@springer.com> wrote: > Hi All, > > I want to use timers to check if certain variables are set and if not > send some data back to a client... > > Been searching for this a while now, but all I can find on alarm are > examples on timing out commands.... snip >>All the [alarm][0] function does is send the [ALRM][0] signal to the >>current process after X seconds. It is often used to turn a blocking >>function into a non-blocking function (i.e. a timeout), but any code >>can be put into the signal handler. Here is some code that does >>something different with it: Hi Chas, I'm looking for something like this, I'm not sure if alarm() is made for such checks but I'm wondering how to do this... Timer for 30 seconds If ($data eq "something") { Print "OK\n"; } else { After 30 seconds Print "No data received, try again later\n"; } Marco!