| 1 | 2 | ▶ | use 5.20.0; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||
| 5 | package DBIx::Class::Smooth::Lookup::substring; | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | # ABSTRACT: Short intro | ||||||||||||||||||||||||||||
| 8 | 2 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | |||||||||||||||||||||||||||
| 9 | 2 | our $VERSION = '0.0108'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use parent 'DBIx::Class::Smooth::Lookup::Util'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use Carp qw/confess/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 2 | ▶ | use experimental qw/signatures postderef/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 0 | ▶ | sub smooth__lookup__substring($self, $column_name, $value, $params, @rest) { | ||||||||||||||||||||||||||
|
Subroutine
smooth__lookup__substring: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 16 | 0 | $self->smooth__lookup_util__ensure_value_is_scalar('substring', $value); | |||||||||||||||||||||||||||
| 17 | 0 | $self->smooth__lookup_util__ensure_param_count('substring', $params, { at_least => 1, at_most => 2, regex => qr/^\-?\d+$/ }); | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | ▶ | if(scalar $params->@* < 1 || scalar $params->@* > 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
scalar @$params < 1 or scalar @$params > 2
MC/DC0%0/2
scalar @$params < 1 or scalar @$params > 2
scalar @$params < 1
scalar @$params > 2
Truth table0%0/3
A or B
A= scalar @$params < 1B= scalar @$params > 2
| |||||||||||||||||||||||||||||
| 20 | 0 | confess sprintf 'substring expects one or two params, got <%s>', join (', ' => $params->@*); | |||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | 0 | my @secure_params = grep { /^\-?\d+$/ } $params->@*; | |||||||||||||||||||||||||||
| 23 | 0 | ▶ | if(scalar @secure_params != scalar $params->@*) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 24 | 0 | confess sprintf 'substring got faulty params: <%s>', join (', ' => $params->@*); | |||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | my $param_string = join ', ' => @secure_params; | |||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | return { left_hand_function => { start => 'SUBSTRING(', end => ", $param_string)" } , value => $value }; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 2 | 1; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | __END__ | ||||||||||||||||||||||||||||