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