Distribute sized items to buckets with limited size
So, you own a number of mp3-Songs on your hard disc and want to copy them
to a number of CDs, maxing out the space available on each of them? You
want to distribute your picture collection into several folders, so each of
them doesn't exceed a certain size? 'Algorithm::Bucketizer' comes to the
'Algorithm::Bucketizer' distributes items of a defined size into a number
of dynamically created buckets, each of them capable of holding items of a
defined total size.
By calling the '$bucketizer->add_item()' method with the item (can be a
scalar or an object reference) and its size as parameters, you're adding
items to the system. The bucketizer will determine if the item fits into
one of the existing buckets and put it in there if possible. If none of the
existing buckets has enough space left to hold the new item (or if no
buckets exist yet for that matter), the bucketizer will create a new bucket
and put the item in there.
After adding all items to the system, the bucketizer lets you iterate over
all buckets with the '$bucketizer->items()' method and determine what's in
each of them.
openSUSE Leap 15.4 jaoks pole ametlikku paketti saadaval