blib/lib/Store/Indexed/XS.pm

filter: Statementstmt 53.1% 17 / 32 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 55.5% 5 / 9 Podpod n/a totaltotal 53.6% 22 / 41 CC 3 SCAR 9.5
CC
3
Cov
53%
new
5.5
__ANON__
2.0
__ANON__
2.0
CRAP 2.6
« blib/lib/Store/Indexed.pm ↑ Summary blib/lib/Store/Indexed/PP.pm »
1 package Store::Indexed::XS;
2 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use XSLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 our $VERSION = '0.1';
7 XSLoader::load(__PACKAGE__, $VERSION);
8  
9 1 ▶sub new {
Subroutine new: called CC=3 SCAR=17.0
10 1 my ($class, @keys) = @_;
11 1 my %offset;
12 1 my $i = 0;
13 1 $offset{$_} = $i++ for @keys;
14  
15 # _new returns the blessed scalar reference
16 1 my $self = Store::Indexed::XS::_new($class, scalar @keys);
17  
18 # Method injection
19 2 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
20 0 for my $key (@keys) {
21 0 my $col = $offset{$key};
22 0 ▶ *{"${class}::get_$key"} = sub {$_[0]->_get($_[1], $col)};
Subroutine __ANON__: not called CC=1 SCAR=6.9
23 0 ▶ *{"${class}::set_$key"} = sub {$_[0]->_set($_[1], $col, $_[2])};
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 0 ▶ *{"${class}::exists_$key"} = sub {$_[0]->_exists($_[1], $col)};
Subroutine __ANON__: not called CC=1 SCAR=6.9
25 0 ▶ *{"${class}::delete_$key"} = sub {$_[0]->_delete($_[1], $col)};
Subroutine __ANON__: not called CC=1 SCAR=6.9
26 }
27 0 return $self;
28 }
29 1;
« blib/lib/Store/Indexed.pm ↑ Summary blib/lib/Store/Indexed/PP.pm »