> -------- Original Message --------
> Subject: Calling subroutine every second using alarm fails
> From: Kelly Jones <[email protected]>
> Date: Wed, April 01, 2009 5:48 am
> To: [email protected]
>
>
> I want a script that constantly accepts user input, but runs a
> subroutine every second to do other work.
what I thought is to fork a child to do the stuff.
my $child = fork;
die "cant fork $!" unless defined $child;
if ($child) { # in parent
while(<>) {
# do something
}
} else { # in child
while( some_condition ) {
# do stuff
sleep 1;
}
exit 0;
}
regards,
Jeff.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/