line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
9
|
|
|
9
|
|
5027
|
use 5.006; |
|
9
|
|
|
|
|
65
|
|
2
|
9
|
|
|
9
|
|
41
|
use strict; |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
187
|
|
3
|
9
|
|
|
9
|
|
31
|
use warnings; |
|
9
|
|
|
|
|
11
|
|
|
9
|
|
|
|
|
623
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Set::Associate::NewKey::PickOffset; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Associate a key with a value from a pool based on the keys value as a numeric offset. |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.004001'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY |
12
|
|
|
|
|
|
|
|
13
|
9
|
|
|
9
|
|
452
|
use Moose qw( with ); |
|
9
|
|
|
|
|
330286
|
|
|
9
|
|
|
|
|
57
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
with 'Set::Associate::Role::NewKey' => { can_get_assoc => 1, }; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
18
|
|
|
|
|
|
|
|
19
|
9
|
|
|
9
|
|
38312
|
no Moose; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
37
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
0
|
1
|
0
|
sub name { 'pick_offset' } |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub get_assoc { |
40
|
9
|
|
|
9
|
|
1453
|
use bigint; |
|
9
|
|
|
|
|
2438
|
|
|
9
|
|
|
|
|
48
|
|
41
|
28
|
|
|
28
|
1
|
11445
|
return $_[1]->_items_cache_get( $_[2] % $_[1]->_items_cache_count ); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
1; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
__END__ |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=pod |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=encoding UTF-8 |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 NAME |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Set::Associate::NewKey::PickOffset - Associate a key with a value from a pool based on the keys value as a numeric offset. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 VERSION |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
version 0.004001 |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head1 METHODS |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 name |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
The name of this key assignment method ( C<pick_offset> ) |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head2 get_assoc |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Returns a value non-destructively by picking an item at numerical offset C<$new_key> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
my $value = $object->get_assoc( $set_assoc, $new_key ); |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
B<Note:> C<$new_key> is automatically modulo of the length of C<$set_assoc>, so offsets beyond end of array are safe, and wrap. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 AUTHOR |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Kent Fredric <kentnl@cpan.org> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
83
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |