| 1 | package TableData::Test::Source::Iterator; | ||||||||||||
| 2 | |||||||||||||
| 3 | 2 | ▶ | use 5.010001; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 2 | ▶ | use Role::Tiny::With; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 2 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |||||||||||
| 10 | 2 | our $DATE = '2024-05-14'; # DATE | |||||||||||
| 11 | 2 | our $DIST = 'TableDataRoles-Standard'; # DIST | |||||||||||
| 12 | 2 | our $VERSION = '0.025'; # VERSION | |||||||||||
| 13 | |||||||||||||
| 14 | 2 | with 'TableDataRole::Source::Iterator'; | |||||||||||
| 15 | |||||||||||||
| 16 | 1 | ▶ | sub new { | ||||||||||
|
Subroutine
new: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||
| 17 | 1 | my ($class, %args) = @_; | |||||||||||
| 18 | 1 | ▶ | $args{num_rows} //= 10; | ||||||||||
|
Condition50%1/2
$args{"num_rows"} //= 10
MC/DC0%0/1
$args{"num_rows"} //= 10
$args{"num_rows"}
Truth table50%1/2
A
A= $args{"num_rows"}
| |||||||||||||
| 19 | 1 | ▶ | $args{random} //= 0; | ||||||||||
|
Condition50%1/2
$args{"random"} //= 0
MC/DC0%0/1
$args{"random"} //= 0
$args{"random"}
Truth table50%1/2
A
A= $args{"random"}
| |||||||||||||
| 20 | |||||||||||||
| 21 | $class->_new( | ||||||||||||
| 22 | 4 | ▶ | gen_iterator => sub { | ||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||
| 23 | 4 | my $i = 0; | |||||||||||
| 24 | 9 | ▶ | sub { | ||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
| |||||||||||||
| 25 | 9 | $i++; | |||||||||||
| 26 | 9 | ▶ | return undef if $i > $args{num_rows}; ## no critic: Subroutines::ProhibitExplicitReturnUndef | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 27 | 8 | ▶ | return {i=>$args{random} ? int(rand()*$args{num_rows} + 1) : $i}; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 28 | 4 | }; | |||||||||||
| 29 | }, | ||||||||||||
| 30 | 1 | ); | |||||||||||
| 31 | } | ||||||||||||
| 32 | |||||||||||||
| 33 | 2 | 1; | |||||||||||
| 34 | # ABSTRACT: A test table | ||||||||||||
| 35 | |||||||||||||
| 36 | __END__ | ||||||||||||