| 1 | 4 | ▶ | use 5.006; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 4 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 4 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | package Set::Associate::RefillItems::Shuffle; | ||
| 6 | |||
| 7 | # ABSTRACT: a refill method that replenishes the cache with a shuffled list | ||
| 8 | |||
| 9 | 4 | our $VERSION = '0.004000'; | |
| 10 | |||
| 11 | 4 | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | |
| 12 | |||
| 13 | 4 | ▶ | use Moose qw( with has ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | 4 | with 'Set::Associate::Role::RefillItems' => { can_get_all => 1, }; | |
| 16 | |||
| 17 | |||
| 18 | |||
| 19 | |||
| 20 | |||
| 21 | |||
| 22 | |||
| 23 | |||
| 24 | |||
| 25 | 4 | has items => ( isa => 'ArrayRef', is => 'rw', required => 1 ); | |
| 26 | |||
| 27 | 4 | __PACKAGE__->meta->make_immutable; | |
| 28 | |||
| 29 | 4 | ▶ | no Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | |||
| 31 | |||
| 32 | |||
| 33 | |||
| 34 | |||
| 35 | |||
| 36 | |||
| 37 | 0 | ▶ | sub name { 'shuffle' } |
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 38 | |||
| 39 | 4 | ▶ | use List::Util qw( shuffle ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 40 | |||
| 41 | |||
| 42 | |||
| 43 | |||
| 44 | |||
| 45 | |||
| 46 | |||
| 47 | 4 | ▶ | sub get_all { return shuffle( @{ $_[0]->items } ) } |
|
Subroutine
get_all: called CC=1 SCAR=0.0
Pod
documented
| |||
| 48 | |||
| 49 | 4 | 1; | |
| 50 | |||
| 51 | __END__ | ||
| 52 | |||
| 53 | =pod | ||
| 54 | |||
| 55 | =encoding UTF-8 | ||
| 56 | |||
| 57 | =head1 NAME | ||
| 58 | |||
| 59 | Set::Associate::RefillItems::Shuffle - a refill method that replenishes the cache with a shuffled list | ||
| 60 | |||
| 61 | =head1 VERSION | ||
| 62 | |||
| 63 | version 0.004000 | ||
| 64 | |||
| 65 | =head1 CONSTRUCTOR ARGUMENTS | ||
| 66 | |||
| 67 | =head2 items | ||
| 68 | |||
| 69 | required ArrayRef | ||
| 70 | |||
| 71 | =head1 METHODS | ||
| 72 | |||
| 73 | =head2 name | ||
| 74 | |||
| 75 | The name of this refill method ( C<shuffle> ) | ||
| 76 | |||
| 77 | =head2 get_all | ||
| 78 | |||
| 79 | Get a new copy of C<items> in shuffled form. | ||
| 80 | |||
| 81 | =head1 ATTRIBUTES | ||
| 82 | |||
| 83 | =head2 items | ||
| 84 | |||
| 85 | =head1 AUTHOR | ||
| 86 | |||
| 87 | Kent Fredric <kentnl@cpan.org> | ||
| 88 | |||
| 89 | =head1 COPYRIGHT AND LICENSE | ||
| 90 | |||
| 91 | This software is copyright (c) 2015 by Kent Fredric <kentfredric@gmail.com>. | ||
| 92 | |||
| 93 | This is free software; you can redistribute it and/or modify it under | ||
| 94 | the same terms as the Perl 5 programming language system itself. | ||
| 95 | |||
| 96 | =cut | ||