Sub::Throttle - Throttle load of perl function


Sub-Throttle documentation  | view source Contained in the Sub-Throttle distribution.

Index


SYNOPSIS

Top

  use Sub::Throttle qw(throttle);

  my $load = 0.1;

  throttle($load, sub { ... });
  throttle($load, \&subref, @args);

DESCRIPTION

Top

Throttles the load of perl function by calling sleep.

METHODS

Top

throttle($load, $subref [, @subargs])

Calls sleep after executing $subref with given @subargs so that the ratio of execution time becomes equal to $load.

AUTHOR

Top

Kazuho Oku <kazuhooku at gmail.com>

COPYRIGHT AND LICENSE

Top


Sub-Throttle documentation  | view source Contained in the Sub-Throttle distribution.