Data/Frame/Role/Rlike.pm

filter: Statementstmt 100% 43 / 43 Branchbran 75.0% 12 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 3 / 3 totaltotal 94.0% 63 / 67 CC 9 SCAR 14.1
CC
9
Cov
93%
head
5.0
tail
5.0
BEGIN
1.0
CRAP 4.1
« Data/Frame/Indexer.pm ↑ Summary PDL/Factor.pm »
1 package Data::Frame::Role::Rlike;
2 11 $Data::Frame::Role::Rlike::VERSION = '0.006005';
3  
4 11 ▶use Data::Frame::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 11 ▶use List::AllUtils;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8  
9 32 ▶method head($n=6) {
Subroutine head: called CC=5 SCAR=16.1
Pod documented
Branch: 3 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for method head (expected 1, got ' . @_ . ')') 0 32 32
@_ > 2 and Function::Parameters::_croak('Too many arguments for method head (expected 2, got ' . @_ . ')') 0 32 32
@_ < 1 and $n = 6 1 31 32
10 32 my ($start, $stop);
11 32 ▶ if( $n < 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n < 0) { } 4 28 32
12 4 $start = 0;
13 4 $stop = $self->number_of_rows + $n - 1;
14 } else {
15 28 $start = 0;
16 28 $stop = $n - 1;
17 }
18 # clip to [ 0, number_of_rows-1 ]
19 32 $start = List::AllUtils::max( 0, $start );
20 32 $stop = List::AllUtils::min( $self->number_of_rows-1, $stop );
21 32 return $self->select_rows( $start..$stop );
22 11 }
23  
24 13 ▶method tail($n=6) {
Subroutine tail: called CC=5 SCAR=16.1
Pod documented
Branch: 3 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for method tail (expected 1, got ' . @_ . ')') 0 13 13
@_ > 2 and Function::Parameters::_croak('Too many arguments for method tail (expected 2, got ' . @_ . ')') 0 13 13
@_ < 1 and $n = 6 1 12 13
25 13 my ($start, $stop);
26 13 ▶ if( $n < 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n < 0) { } 4 9 13
27 4 $start = -$n;
28 4 $stop = $self->number_of_rows - 1;
29 } else {
30 9 $start = $self->number_of_rows - $n;
31 9 $stop = $self->number_of_rows - 1;
32 }
33 # clip to [ 0, number_of_rows-1 ]
34 13 $start = List::AllUtils::max( 0, $start );
35 13 $stop = List::AllUtils::min( $self->number_of_rows-1, $stop );
36 13 return $self->select_rows( $start..$stop );
37 11 }
38  
39 3 ▶sub subset($&) {
Subroutine subset: called CC=1 SCAR=0.0
Pod documented
40 3 my ($df, $cb) = @_;
41 3 my $ch = $df->_column_helper;
42 3 local *_ = \$ch;
43 3 my $where = $cb->($df);
44 3 $df->select_rows( $where->which );
45 }
46  
47 11 1;
48  
49 __END__
« Data/Frame/Indexer.pm ↑ Summary PDL/Factor.pm »