Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Algorithm-TokenBucket CPAN distribution.

Report information
The Basics
Id: 80243
Status: resolved
Priority: 0/
Queue: Algorithm-TokenBucket

People
Owner: KAPPA [...] cpan.org
Requestors: world.mind [...] yahoo.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Patch: method for get current tokens count
Simple patch that add method for get current tokens count
Subject: get_tokens_count_patch.diff
--- /usr/local/lib/perl5/site_perl/5.10.1/Algorithm/TokenBucket.pm.orig 2012-10-17 16:32:22.000000000 +0400 +++ /usr/local/lib/perl5/site_perl/5.10.1/Algorithm/TokenBucket.pm 2012-10-17 16:37:30.000000000 +0400 @@ -161,6 +161,18 @@ sub conform { return $self->{_tokens} >= $size; } +=item get() + +Returns count of tokens in bucket + +=cut + +sub get { + my Algorithm::TokenBucket $self = shift; + $self->_token_flow; + return $self->{_tokens}; +} + =item count($) This sub removes I<N> (or all if there are less than I<N> available) tokens from the bucket.
Fixed in 0.35.