blib/lib/UR/BoolExpr/Template/PropertyComparison/NotEquals.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 3 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 44 SCAR 37.4
CC
6
Cov
0%
_compare
42.0
BEGIN
2.0
BEGIN
2.0
CRAP 42.0
1  
2 package UR::BoolExpr::Template::PropertyComparison::NotEquals;
3  
4 use strict;
5 use warnings;
6 use UR;
7 our $VERSION = "0.46"; # UR $VERSION;
8  
9 UR::Object::Type->define(
10 class_name => __PACKAGE__,
11 is => ['UR::BoolExpr::Template::PropertyComparison'],
12 );
13  
14 sub _compare {
15 my ($class,$comparison_value,@property_value) = @_;
16  
17 no warnings 'uninitialized';
18 if (@property_value == 0) {
19 return ($comparison_value eq '' ? '' : 1);
20 }
21  
22 my $cv_is_number = Scalar::Util::looks_like_number($comparison_value);
23  
24 foreach my $property_value ( @property_value ) {
25 my $pv_is_number = Scalar::Util::looks_like_number($property_value);
26  
27 if ($cv_is_number and $pv_is_number) {
28 return '' if ( $property_value == $comparison_value );
29 } else {
30 return '' if ( $property_value eq $comparison_value );
31 }
32 }
33 return 1;
34 }
35  
36  
37 1;
38  
39 =pod
40  
41 =head1 NAME
42  
43 UR::BoolExpr::Template::PropertyComparison::NotEqual - perform a not-equal test
44  
45 =head1 DESCRIPTION
46  
47 If the property returns multiple values, this comparison returns false if any if the values
48 are equal to the comparison value
49  
50 =cut