| 1 | 20 | ▶ | use 5.20.0; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 20 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 20 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | package DBIx::Class::Smooth::Lookup::Util; | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | # ABSTRACT: Short intro | ||||||||||||||||||||||||||||
| 8 | 20 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | |||||||||||||||||||||||||||
| 9 | 20 | our $VERSION = '0.0108'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 20 | ▶ | use parent qw/ | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | DBIx::Class::Smooth::ResultSetBase | ||||||||||||||||||||||||||||
| 13 | 20 | /; | |||||||||||||||||||||||||||
| 14 | 20 | ▶ | use Carp qw/confess/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | 20 | ▶ | use experimental qw/signatures postderef/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 0 | ▶ | sub smooth__lookup_util__ensure_value_is_arrayref($self, $lookup_name, $value) { | ||||||||||||||||||||||||||
|
Subroutine
smooth__lookup_util__ensure_value_is_arrayref: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 18 | 0 | ▶ | if(ref $value ne 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 19 | 0 | confess sprintf '<%s> expects an array, got <%s>', $lookup_name, $value; | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub smooth__lookup_util__ensure_value_is_scalar($self, $lookup_name, $value) { | ||||||||||||||||||||||||||
|
Subroutine
smooth__lookup_util__ensure_value_is_scalar: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | if(ref $value) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | 0 | confess sprintf '<%s> expects a scalar, got a <%s>', $lookup_name, ref($value); | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | sub smooth__lookup_util__ensure_param_count($self, $lookup_name, $params, $ensure_options) { | ||||||||||||||||||||||||||
|
Subroutine
smooth__lookup_util__ensure_param_count: not called CC=9 SCAR=45.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | my $at_least = delete $ensure_options->{'at_least'} || 0; | ||||||||||||||||||||||||||
|
Condition0%0/2
delete $ensure_options->{'at_least'} || 0
MC/DC0%0/1
delete $ensure_options->{'at_least'} || 0
delete $ensure_options->{'at_least'}
Truth table0%0/2
A
A= delete $ensure_options->{'at_least'}
| |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | my $at_most = delete $ensure_options->{'at_most'} || 10000; | ||||||||||||||||||||||||||
|
Condition0%0/2
delete $ensure_options->{'at_most'} || 10000
MC/DC0%0/1
delete $ensure_options->{'at_most'} || 10000
delete $ensure_options->{'at_most'}
Truth table0%0/2
A
A= delete $ensure_options->{'at_most'}
| |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | my $regex = delete $ensure_options->{'regex'} || undef; | ||||||||||||||||||||||||||
|
Condition0%0/2
delete $ensure_options->{'regex'} || undef
MC/DC0%0/1
delete $ensure_options->{'regex'} || undef
delete $ensure_options->{'regex'}
Truth table0%0/2
A
A= delete $ensure_options->{'regex'}
| |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | ▶ | if(keys $ensure_options->%*) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 35 | 0 | confess sprintf "Unexpected keys <%s>", join(', ', sort keys $ensure_options->%*); | |||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | 0 | ▶ | if(scalar $params->@* < $at_least || scalar $params->@* > $at_most) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
scalar @$params < $at_least or scalar @$params > $at_most
MC/DC0%0/2
scalar @$params < $at_least or scalar @$params > $at_most
scalar @$params < $at_least
scalar @$params > $at_most
Truth table0%0/3
A or B
A= scalar @$params < $at_leastB= scalar @$params > $at_most
| |||||||||||||||||||||||||||||
| 39 | 0 | confess sprintf "<%s> expects between $at_least and $at_most params, got %d: <%s>", $lookup_name, scalar ($params->@*), join (', ' => $params->@*); | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | ▶ | if($regex) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 43 | 0 | my @correct_params = grep { /$regex/ } $params->@*; | |||||||||||||||||||||||||||
| 44 | 0 | ▶ | if(scalar @correct_params != scalar $params->@*) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 0 | confess sprintf '<%s> got faulty params, check documentation: <%s>', $lookup_name, join (', ' => $params->@*); | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 20 | 1; | |||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | __END__ | ||||||||||||||||||||||||||||