Name : perl-Time-DoAfter
| |
Version : 1.08
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : lp155.1.1
| Date : 2023-07-20 19:36:41
|
Group : Unspecified
| Source RPM : perl-Time-DoAfter-1.08-lp155.1.1.src.rpm
|
Size : 0.02 MB
| |
Packager : https://www_suse_com/
| |
Summary : Wait before doing by label contoller singleton
|
Description :
This library provides a means to do something after waiting a specified period of time since the previous invocation under the same something label. Also, it\'s a singleton.
Let\'s say you have a situation where you want to do something every 2 seconds, but that thing you want to do might take anywhere between 0.5 and 1.5 seconds to accomplish. Basically, you want to wait for a period of time since the last invocation such that the next invocation is 2 seconds after the previous.
my $tda = Time::DoAfter->new(2);
$tda->do( sub {} ); # pretend this first action takes 0.5 seconds to complete $tda->do( sub {} ); # this second action will wait 1.5 seconds before starting
Alternatively, let\'s say you\'re web scraping and you want to keep the requests to a specific host separated by a random amount of time between 0.5 and 1.5 seconds.
my $tda = Time::DoAfter->new( [ 0.5, 1.5 ] ); $tda->do( sub { scrape_a_new_web_page($_) } ) for (AATTpages);
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-T/15.5/noarch |