Home > Fork-setTimeout

Fork-setTimeout

Fork-setTimeout is a project mainly written in Perl, it's free.

Implementation of setTimeout() function in JavaScript

NAME

Fork::setTimeout - Implementation of setTimeout() function in JavaScript

SYNOPSIS

use Fork::setTimeout;

my $timer = setTimeout(sub { ... }, 10); clearTimeout($timer);

DESCRIPTION

An emulation of setTimeout() funcion in JavaScript using fork(2).

METHODS

setTimeout( I<$code>, I<$msec> )

my $timer = setTimeout(sub { ... }, 10);

Dispatches $code after $msec micro seconds.

You should store the return value, $timer, in some lexical variable to wait for child process to finish dispatching $code.

clearTimeout( I<$timer> )

clearTimeout($timer);

Kills the child process and clear $timer out.

AUTHOR

Kentaro Kuribayashi [email protected]

SEE ALSO

LICENSE

Copyright (C) Kentaro Kuribayashi

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Previous:jEBC-Blog