Acme-Urinal

 view release on metacpan or  search on metacpan

lib/Acme/Urinal.pm  view on Meta::CPAN


  $urinal->leave(2);
  $urinal->leave(1);
  say $urinal->pick_one; # prints 1


=head1 DESCRIPTION

When men use a bathroom with multiple urinals. The way the urinal to use is
chosen is nearly deterministic. This module allocates resources in a way that
emulates this process.

Basically, a L<Acme::Urinal> object keeps track of a list of resources. You can
then request these resources be allocated and used by asking for one using the
L</pick_one> method. It will return the next resource according to the
algorithm. Once finished suing that resource, you may return it using the
L</leave> method.

Each resource is chosen according to the following rules:

=over



( run in 0.275 second using v1.01-cache-2.11-cpan-8d75d55dd25 )