| 1 | package DBIx::Class::Helper::ResultSet::SearchOr; | ||||||||||
| 2 | 56 | $DBIx::Class::Helper::ResultSet::SearchOr::VERSION = '2.037000'; | |||||||||
| 3 | # ABSTRACT: Combine ResultSet searches with OR's | ||||||||||
| 4 | |||||||||||
| 5 | 56 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 56 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 56 | ▶ | use parent 'DBIx::Class::ResultSet'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 56 | ▶ | use List::Util 'first'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 56 | ▶ | use Carp::Clan; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 56 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 2 | ▶ | sub search_or { | ||||||||
|
Subroutine
search_or: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 15 | 2 | my $self = shift; | |||||||||
| 16 | 2 | my @others = @{shift @_ }; | |||||||||
| 17 | |||||||||||
| 18 | croak 'All ResultSets passed to search_or must have the same result_source ' . | ||||||||||
| 19 | 2 | ▶ | 'as the invocant!' if first { $self->result_source != $_->result_source } @others; | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||
| 20 | |||||||||||
| 21 | $self->search({ | ||||||||||
| 22 | -or => [ | ||||||||||
| 23 | map $_->_resolved_attrs->{where}, @others | ||||||||||
| 24 | 1 | ], | |||||||||
| 25 | }); | ||||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 56 | 1; | |||||||||
| 29 | |||||||||||
| 30 | __END__ | ||||||||||