| 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
Condition66%2/3
defined $value and &try(sub {
$self->_is_column_numeric($col);
}
)
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);
}
)
| |||||||||||||||||||||||||||||
| 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
Condition33%1/3
defined $columns{$_} and &try(sub {
$self->_is_column_numeric($_);
}
)
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($_);
}
)
| |||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 5 | return %columns; | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 56 | 1; | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | __END__ | ||||||||||||||||||||||||||||