Helper/Row/NumifyGet.pm

filter: Statementstmt 100% 25 / 25 Branchbran 75.0% 3 / 4 Conditioncond 50.0% 3 / 6 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 85.7% 42 / 49 CC 6 SCAR 9.1
CC
6
Cov
89%
get_columns
4.3
get_column
3.0
__ANON__
1.1
CRAP 2.5
« Helper/ResultSet/ResultClassDWIM.pm ↑ Summary Helper/ResultSet/AutoRemoveColumns.pm »
1 package DBIx::Class::Helper::Row::NumifyGet;
2 56 $DBIx::Class::Helper::Row::NumifyGet::VERSION = '2.037000';
3 # ABSTRACT: Force numeric "context" on numeric columns
4  
5 56 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 56 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 56 ▶use parent 'DBIx::Class::Row';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 56 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 123 ▶sub get_column {
Subroutine get_column: called CC=3 SCAR=11.0
Pod documented
13 123 my ($self, $col) = @_;
14  
15 123 my $value = $self->next::method($col);
16  
17 $value += 0 if defined($value) and # for nullable and autoinc fields
18 123 ▶ try { $self->_is_column_numeric($col) };
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if defined $value and &try(sub { $self->_is_column_numeric($col); } ) 118 5 123
Condition66%2/3
defined $value and &try(sub { $self->_is_column_numeric($col); } )
!ll&&!rl&&r
05118
MC/DC50%1/2
defined $value and &try(sub { $self->_is_column_numeric($col); } )
defined $value &try(sub { $self->_is_column_numeric($col); } )
Truth table66%2/3
A and B
A= defined $valueB= &try(sub { $self->_is_column_numeric($col); } )
ABresult
0X0
100
111
19  
20 123 return $value;
21 }
22  
23 5 ▶sub get_columns {
Subroutine get_columns: called CC=4 SCAR=14.6
Pod documented
24 5 my ($self, $col) = @_;
25  
26 5 my %columns = $self->next::method($col);
27  
28 5 for (keys %columns) {
29 $columns{$_} += 0
30 if defined($columns{$_}) and # for nullable and autoinc fields
31 10 ▶ try { $self->_is_column_numeric($_) };
Subroutine __ANON__: called CC=1 SCAR=0.8
Branch: 1 branch
BranchTrueFalseTotal
if defined $columns{$_} and &try(sub { $self->_is_column_numeric($_); } ) 10 0 10
Condition33%1/3
defined $columns{$_} and &try(sub { $self->_is_column_numeric($_); } )
!ll&&!rl&&r
0010
MC/DC0%0/2
defined $columns{$_} and &try(sub { $self->_is_column_numeric($_); } )
defined $columns{$_} &try(sub { $self->_is_column_numeric($_); } )
Truth table33%1/3
A and B
A= defined $columns{$_}B= &try(sub { $self->_is_column_numeric($_); } )
ABresult
0X0
100
111
32 }
33  
34 5 return %columns;
35 }
36  
37 56 1;
38  
39 __END__
« Helper/ResultSet/ResultClassDWIM.pm ↑ Summary Helper/ResultSet/AutoRemoveColumns.pm »