| 1 | package DTL::Fast::Filter::Random; | ||||||||||||||||||||||||||||||
| 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{'random'} = __PACKAGE__; | |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||
| 7 | #@Override | ||||||||||||||||||||||||||||||
| 8 | sub filter | ||||||||||||||||||||||||||||||
| 9 | { | ||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | my( $self, $filter_manager, $value, $context ) = @_; | ||||||||||||||||||||||||||||
|
Subroutine
filter: called CC=4 SCAR=19.1
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||
| 12 | 2 | ▶ | die $self->get_render_error( | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/4
$value // "undef"
ref $value || 'SCALAR'
MC/DC0%0/1
$value // "undef"
$value
MC/DC0%0/1
ref $value || 'SCALAR'
ref $value
Truth table0%0/2
A
A= $value
Truth table0%0/2
A
A= ref $value
| |||||||||||||||||||||||||||||||
| 13 | $context, | ||||||||||||||||||||||||||||||
| 14 | sprintf("Argument must be an ARRAY ref, not %s (%s)" | ||||||||||||||||||||||||||||||
| 15 | , $value // 'undef' | ||||||||||||||||||||||||||||||
| 16 | , ref $value || 'SCALAR' | ||||||||||||||||||||||||||||||
| 17 | ) | ||||||||||||||||||||||||||||||
| 18 | ) if ref $value ne 'ARRAY'; | ||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||
| 20 | 2 | return $value->[int(rand scalar @$value)]; | |||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||
| 23 | 2 | 1; | |||||||||||||||||||||||||||||