| 1 | package Data::Model::Iterator; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | use overload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 8 | ▶ | '<>' => sub { shift->next }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 5 | fallback => 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=4 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 2 | my($class, $code, %args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | bless { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | code => $code, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | cache => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | count => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | reset => delete $args{reset} || sub {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | end => delete $args{end} || sub {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 4 | ▶ | wrapper => delete $args{wrapper} || sub { shift }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | }, $class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%3/9
delete $args{'reset'} || sub {
}
delete $args{'end'} || sub {
}
delete $args{'wrapper'} || sub {
shift();
}
MC/DC0%0/2
delete $args{'reset'} || sub {
}
delete $args{'reset'}
sub {
}
MC/DC0%0/2
delete $args{'end'} || sub {
}
delete $args{'end'}
sub {
}
MC/DC0%0/2
delete $args{'wrapper'} || sub {
shift();
}
delete $args{'wrapper'}
sub {
shift();
}
Truth table33%1/3
A || B
A= delete $args{'reset'}B= sub {
}
Truth table33%1/3
A || B
A= delete $args{'end'}B= sub {
}
Truth table33%1/3
A || B
A= delete $args{'wrapper'}B= sub {
shift();
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 19 | ▶ | sub has_next { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_next: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 19 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 19 | my $obj = $self->next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 19 | $self->{count}--; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 19 | !!$obj; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 39 | ▶ | sub next { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 39 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 39 | ▶ | $self->{cache}->[$self->{count}++] ||= do { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$self->{"cache"}[$self->{"count"}++] ||= do {
my $obj = $self->{"code"}->();
$obj ? $self->{"wrapper"}->($obj) : undef
}
MC/DC100%2/2
$self->{"cache"}[$self->{"count"}++] ||= do {
my $obj = $self->{"code"}->();
$obj ? $self->{"wrapper"}->($obj) : undef
}
$self->{"cache"}[$self->{"count"}++]
do {
my $obj = $self->{"code"}->();
$obj ? $self->{"wrapper"}->($obj) : undef
}
Truth table100%3/3
A ||= B
A= $self->{"cache"}[$self->{"count"}++]B= do {
my $obj = $self->{"code"}->();
$obj ? $self->{"wrapper"}->($obj) : undef
}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 19 | my $obj = $self->{code}->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 19 | ▶ | $obj ? $self->{wrapper}->( $obj ) : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 5 | ▶ | sub reset { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 5 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 5 | $self->{count} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 5 | $self->{reset}->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 4 | ▶ | sub end { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 4 | $self->{end}->(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 2 | ▶ | sub DESTROY { shift->end }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | package Data::Model::Iterator::Empty; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | use overload | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | q{""} => sub { undef }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | q{0+} => sub { undef }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 1 | ▶ | 'bool' => sub { undef }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 2 | ▶ | '<>' => sub { shift->next }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 5 | fallback => 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 1 | ▶ | sub new { bless {}, shift } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 4 | ▶ | sub has_next { 0 } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
has_next: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 4 | ▶ | sub next { undef } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 1 | ▶ | sub reset { undef } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | 1 | ▶ | sub end { undef } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||