blib/lib/DTL/Fast/Filter/First.pm

filter: Statementstmt 94.7% 18 / 19 Branchbran 50.0% 1 / 2 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 72.7% 24 / 33 SCAR 14.4
CC
4
Cov
76%
filter
6.6
BEGIN
1.0
BEGIN
1.0
CRAP 4.2
« blib/lib/DTL/Fast/Tag/With.pm ↑ Summary blib/lib/DTL/Fast/Filter/Last.pm »
1 package DTL::Fast::Filter::First;
2 2 ▶use strict; use utf8; use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3 2 ▶use parent 'DTL::Fast::Filter';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 $DTL::Fast::FILTER_HANDLERS{'first'} = __PACKAGE__;
6  
7 #@Override
8 sub filter
9 {
10 2 ▶ my ($self, $filter_manager, $value, $context) = @_;
Subroutine filter: called CC=4 SCAR=18.9
Pod undocumented
11  
12 2 ▶ if( ref $value eq 'ARRAY' )
Branch: 1 branch
BranchTrueFalseTotal
if (ref $value eq 'ARRAY') { } 2 0 2
13 {
14 2 $value = $value->[0];
15 }
16 else
17 {
18 0 ▶ die $self->get_render_error(
Condition0%0/4
$value // "undef"
l!l
00
ref $value || 'SCALAR'
l!l
00
MC/DC0%0/1
$value // "undef"
$value
MC/DC0%0/1
ref $value || 'SCALAR'
ref $value
Truth table0%0/2
A
A= $value
Aresult
11
00
Truth table0%0/2
A
A= ref $value
Aresult
11
00
19 $context,
20 sprintf(
21 "first filter may be applied only to an ARRAY reference, not %s (%s)"
22 , $value // 'undef'
23 , ref $value || 'SCALAR'
24 )
25 );
26 }
27
28 2 return $value;
29 }
30  
31 2 1;
« blib/lib/DTL/Fast/Tag/With.pm ↑ Summary blib/lib/DTL/Fast/Filter/Last.pm »