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

NAME

Set::Associate::RefillItems - Pool repopulation methods

VERSION

version 0.002000

DESCRIPTION

This class implements the mechanism which controls how the main pool populates.

The part you're mostly interested in are the "CLASS METHODS", which return the right populator.

This is more or less a wrapper for passing around subs with an implict interface.

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

    my ( @new_pool ) = $populator->run( $set_associate_object );

CONSTRUCTOR ARGUMENTS

name

    required Str

code

    required CodeRef

items

    required ArrayRef

CLASS METHODS

linear

Populate from items each time.

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

shuffle

Populate with a shuffled version of items

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

METHODS

run

runs code attached via "code"

    my ( @list ) = $object->run( $set_associate_object );

Where <@list> is the new pool contents.

ATTRIBUTES

name

code

items

ATTRIBUTE HANDLES

has_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.