Kent Fredric > Set-Associate-0.001001 > Set::Associate::RefillItems

Download:
Set-Associate-0.001001.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.001001   Source   Latest Release: Set-Associate-0.003000

NAME ^

Set::Associate::RefillItems - Pool repopulation methods

VERSION ^

version 0.001001

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

CLASS METHODS ^

linear

Populate from items each time.

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

You can use -> or not if you want, nothing under the hood cares.

shuffle

Populate with a shuffled version of items

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

You can use -> or not if you want, nothing under the hood cares.

METHODS ^

run

runs code attached via "code"

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

Where <@list> is the new pool contents.

ATTRIBUTES ^

name

code

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.

syntax highlighting: