NAME
WWW::Bund::RateLimit - Per-API rate limiting with sliding window
VERSION
version 0.001
SYNOPSIS
use WWW::Bund::RateLimit;
my $limiter = WWW::Bund::RateLimit->new(
limits => {
tagesschau => { max => 60, window => 3600 },
smard => { max => 60, window => 3600 },
},
);
# Check rate limit (blocks if exceeded)
$limiter->check('tagesschau');
DESCRIPTION
Enforces per-API rate limits using a sliding window algorithm. If the rate limit is exceeded, check will sleep until the oldest request falls outside the window.
Currently configured limits:
tagesschau: 60 requests per hour
smard: 60 requests per hour
APIs without configured limits are not rate-limited.
limits
HashRef of rate limit configurations per API. Each entry has:
max- Maximum number of requestswindow- Time window in seconds
check
$limiter->check($api_id);
Check rate limit for API. If limit is exceeded, sleeps until a request slot becomes available.
Returns 1 always (after potentially sleeping).
APIs without configured limits pass through immediately.
SUPPORT
Issues
Please report bugs and feature requests on GitHub at https://github.com/Getty/p5-www-bund/issues.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.