Re: Using alarm

2012-10-26 Thread Rob Coops
n run for an x number of seconds 60 at a minimum or 120 maybe even 120 as your code might not get to the end of the loop before then. Using alarm or any type of module based on this function will ensure that you will perform the same action a lot closer to your desired 60 second mark. Using Tim

Re: Using alarm

2012-10-26 Thread Unknown User
On Fri, Oct 26, 2012 at 8:16 PM, Unknown User wrote: > I have code that goes something like this: > > > my $start = time(); > my $delay = 60; > ... > > while (my $line = <$fh>) { > my $err; > ... > ... > my $timenow = time(); > if ( $timenow - $start >= $delay ) { >

Using alarm

2012-10-26 Thread Unknown User
I have code that goes something like this: my $start = time(); my $delay = 60; ... while (my $line = <$fh>) { my $err; ... ... my $timenow = time(); if ( $timenow - $start >= $delay ) { $start = $t; dumpstats($err); $err = {};

Re: test contents of variable using alarm()

2010-08-25 Thread Chas. Owens
ntents of variable using alarm() > > On Fri, Aug 20, 2010 at 04:34, Kammen van, Marco, Springer SBM NL > 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

RE: test contents of variable using alarm()

2010-08-24 Thread Kammen van, Marco, Springer SBM NL
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

Re: test contents of variable using alarm()

2010-08-20 Thread Chas. Owens
On Fri, Aug 20, 2010 at 04:34, Kammen van, Marco, Springer SBM NL 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 comman

test contents of variable using alarm()

2010-08-20 Thread Kammen van, Marco, Springer SBM NL
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 So something like: sub timeout { $timeout = 5; eval { l

Re: Calling subroutine every second using alarm fails

2009-04-01 Thread Chas. Owens
On Wed, Apr 1, 2009 at 20:28, wrote: > Away from PC so I cannot hookup > Is alarm perls internal function? snip The alarm function is part of Core Perl. -- Chas. Owens wonkden.net The most important skill a programmer can have is the ability to read. -- To unsubscribe, e-mail: beginners-unsu

Re: Calling subroutine every second using alarm fails

2009-04-01 Thread rich . japh
Away from PC so I cannot hookup Is alarm perls internal function? -Original Message- From: "Chas. Owens" Date: Wed, 1 Apr 2009 10:18:51 To: Kelly Jones Cc: Subject: Re: Calling subroutine every second using alarm fails On Wed, Apr 1, 2009 at 08:48, Kelly Jones wrote:

Re: Calling subroutine every second using alarm fails

2009-04-01 Thread Chas. Owens
On Wed, Apr 1, 2009 at 08:48, Kelly Jones wrote: > I want a script that constantly accepts user input, but runs a > subroutine every second to do other work. My attempt: > > $|=1; $SIG{'ALRM'}= "\&alarm_sub"; &alarm_sub; > while (<>) {print "You typed: $_\n";} > sub alarm_sub {print "ALARM!\n"; al

Re: Calling subroutine every second using alarm fails

2009-04-01 Thread Kelly Jones
>> Original Message >> Subject: Calling subroutine every second using alarm fails >> From: Kelly Jones >> Date: Wed, April 01, 2009 5:48 am >> To: beginners@perl.org >> >> >> I want a script that constantly accepts user input, b

RE: Calling subroutine every second using alarm fails

2009-04-01 Thread Jeff Pang
> Original Message > Subject: Calling subroutine every second using alarm fails > From: Kelly Jones > Date: Wed, April 01, 2009 5:48 am > To: beginners@perl.org > > > I want a script that constantly accepts user input, but runs a > subroutine ev

Calling subroutine every second using alarm fails

2009-04-01 Thread Kelly Jones
I want a script that constantly accepts user input, but runs a subroutine every second to do other work. My attempt: $|=1; $SIG{'ALRM'}= "\&alarm_sub"; &alarm_sub; while (<>) {print "You typed: $_\n";} sub alarm_sub {print "ALARM!\n"; alarm 1; return;} fails miserably. What's the right way to do