| 1 | package Bootylicious::IteratorSearchable; | ||||||||||
| 2 | |||||||||||
| 3 | 12 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 12 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 12 | ▶ | use base 'Bootylicious::Decorator'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | sub find_first { | ||||||||||
| 9 | 11 | ▶ | my $self = shift; | ||||||||
|
Subroutine
find_first: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 10 | 11 | my $cb = shift; | |||||||||
| 11 | |||||||||||
| 12 | 11 | $self->rewind; | |||||||||
| 13 | |||||||||||
| 14 | 11 | ▶ | while (my $el = $self->next) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 15 | ▶ | if (my $res = $cb->($self->object, $el)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | 6 | return $res; | |||||||||
| 17 | } | ||||||||||
| 18 | } | ||||||||||
| 19 | |||||||||||
| 20 | 5 | return; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | sub find_all { | ||||||||||
| 24 | 9 | ▶ | my $self = shift; | ||||||||
|
Subroutine
find_all: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||
| 25 | 9 | my $cb = shift; | |||||||||
| 26 | |||||||||||
| 27 | 9 | $self->rewind; | |||||||||
| 28 | |||||||||||
| 29 | 9 | my @found_elements; | |||||||||
| 30 | 9 | ▶ | while (my $el = $self->next) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 20 | ▶ | if (my $res = $cb->($self->object, $el)) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 8 | push @found_elements, $res; | |||||||||
| 33 | } | ||||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | 9 | return Bootylicious::Iterator->new(elements => [@found_elements]); | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 12 | 1; | |||||||||