lib/DBIx/Class/Helper/ResultSet/Shortcut/Search/NotBlankOrNull.pm

filter: Statementstmt 100% 26 / 26 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 100% 1 / 1 totaltotal 100% 33 / 33 CC 3 SCAR 6.9
CC
3
Cov
100%
not_blank_or_null
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« lib/DBIx/Class/Helper/ResultSet/Shortcut/Search/IsAny.pm ↑ Summary lib/DBIx/Class/Helper/ResultSet/Shortcut/Search/NullOrZero.pm »
1 package DBIx::Class::Helper::ResultSet::Shortcut::Search::NotBlankOrNull;
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 5 ▶use parent 'DBIx::Class::Helper::ResultSet::Shortcut::Search::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6  
7 2 ▶sub not_blank_or_null {
Subroutine not_blank_or_null: called CC=3 SCAR=11.0
Pod documented
8 2 my ( $self, @columns ) = @_;
9 2 $self->load_components(qw{Helper::ResultSet::SetOperations});
10 2 ▶ if ( !ref $columns[0] ) { # Only sent one column. This is easy.
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $columns[0]) { } 1 1 2
11 1 my $nulls_rs = $self->_helper_apply_search( { '!=' => undef }, @columns );
12 1 my $not_empty_rs = $self->_helper_apply_search( { '!=' => '' }, @columns );
13 1 return $nulls_rs->intersect( [$not_empty_rs] );
14 }
15 else {
16 1 my @rs_array;
17 1 my $i = 0;
18 1 foreach my $column ( @{ $columns[0] } ) {
19 2 my $nulls_rs = $self->_helper_apply_search( { '!=' => undef }, $column );
20 2 my $not_empty_rs = $self->_helper_apply_search( { '!=' => '' }, $column );
21 2 $rs_array[$i] = $nulls_rs->intersect( [$not_empty_rs] );
22 2 $i++;
23 }
24 1 my $result = shift @rs_array;
25 1 return $result->intersect( \@rs_array );
26 }
27 }
28  
29 5 1;
30  
31 __END__
« lib/DBIx/Class/Helper/ResultSet/Shortcut/Search/IsAny.pm ↑ Summary lib/DBIx/Class/Helper/ResultSet/Shortcut/Search/NullOrZero.pm »