| 1 | package Store::Indexed::PP; | ||
| 2 | 2 | $Store::Indexed::PP::VERSION = '0.1'; | |
| 3 | 2 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 2 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 2 | ▶ | sub new { |
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
undocumented
| |||
| 7 | 2 | my ($class, @keys) = @_; | |
| 8 | |||
| 9 | 2 | my $cols = scalar @keys; | |
| 10 | 2 | my %offset; | |
| 11 | 2 | my $i = 0; | |
| 12 | 2 | $offset{$_} = $i++ for sort @keys; | |
| 13 | 2 | my $self = bless [], $class; | |
| 14 | 2 | for my $key (keys %offset) { | |
| 15 | 3 | my $col = $offset{$key}; | |
| 16 | 2 | ▶ | no strict 'refs'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 17 | 3 | ▶ | *{"${class}::get_$key"} = sub { $_[0]->[$_[1] * $cols + $col] }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 18 | 3 | ▶ | *{"${class}::set_$key"} = sub { $_[0]->[$_[1] * $cols + $col] = $_[2] }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 19 | 0 | ▶ | *{"${class}::exists_$key"} = sub { exists $_[0]->[$_[1] * $cols + $col] }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
| |||
| 20 | 0 | ▶ | *{"${class}::delete_$key"} = sub { delete $_[0]->[$_[1] * $cols + $col] }; |
|
Subroutine
__ANON__: not called CC=1 SCAR=0.4
| |||
| 21 | } | ||
| 22 | |||
| 23 | 2 | return $self; | |
| 24 | } | ||
| 25 | |||
| 26 | 2 | 1; | |