The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Set::Associate::RefillItems - Pool re-population methods

VERSION

version 0.003000

DESCRIPTION

This class implements a generalized interface for creating objects which populate pools.

What you're mostly interested in are "CLASS METHODS", which are shorthand (somewhat) for loading and constructing many of the Set::Associate::RefillItems::* family.

However, if your code needs to design its own version on the fly, this interface should work:

    my $populator = Set::Associate::RefillItems->new(
        name => 'foo',
        items => [  .... ],
        code => sub {
            my ( $self, $sa ) = @_;
            ....
        },
    );
    my $sa = Set::Associate->new(
        on_item_empty => $populator ,
        ...
    );

CONSTRUCTOR ARGUMENTS

name

    required Str

code

    required CodeRef

items

    required ArrayRef

CLASS METHODS

linear

Populate from items each time.

See Set::Associate::RefillItems::Linear for details.

    my $sa = Set::Associate->new(
        ...
        on_items_empty => Set::Associate::RefillItems->linear( items => [ ... ])
    );

or ...

    use Set::Associate::RefillItems::Linear;
    my $sa = Set::Associate->new(
        ...
        on_items_empty => Set::Associate::RefillItems::Linear->new( items => [ ... ])
    );

shuffle

Populate with a shuffled version of items

See Set::Associate::RefillItems::Shuffle for details.

    my $sa = Set::Associate->new(
        ...
        on_items_empty => Set::Associate::RefillItems->shuffle( items => [ ... ]);
    );

or ...

    use Set::Associate::RefillItems::Shuffle;
    my $sa = Set::Associate->new(
        ...
        on_items_empty => Set::Associate::RefillItems::Shuffle->new( items => [ ... ])
    );

ATTRIBUTES

name

code

items

ATTRIBUTE HANDLES

get_all

Invokes Trait:Code/execute_method on "code"

has_items

Predicate method for "items"

AUTHOR

Kent Fredric <kentfredric@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Kent Fredric <kentfredric@gmail.com>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.