File Coverage

blib/lib/Role/TinyCommons/Collection/SelectItems.pm
Criterion Covered Total %
statement 3 9 33.3
branch 0 4 0.0
condition n/a
subroutine 1 3 33.3
pod 2 2 100.0
total 6 18 33.3


line stmt bran cond sub pod time code
1             package Role::TinyCommons::Collection::SelectItems;
2              
3 1     1   367953 use Role::Tiny;
  1         8767  
  1         8  
4              
5             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
6             our $DATE = '2024-01-16'; # DATE
7             our $DIST = 'Role-TinyCommons-Collection'; # DIST
8             our $VERSION = '0.010'; # VERSION
9              
10             ### required methods
11              
12             requires 'select_items';
13              
14             ### provided methods
15              
16             sub has_matching_item {
17 0     0 1   my ($self, %args) = @_;
18 0           my @results = $self->select_items(result_limit => 1, %args);
19 0 0         @results ? 1:0;
20             }
21              
22             sub select_first {
23 0     0 1   my ($self, %args) = @_;
24 0           my @results = $self->select_items(result_limit => 1, %args);
25 0 0         @results ? $results[0] : undef;
26             }
27              
28             1;
29             # ABSTRACT: The search_items() interface
30              
31             __END__