File Coverage

lib/UR/BoolExpr/Template/PropertyComparison/GreaterOrEqual.pm
Criterion Covered Total %
statement 19 20 95.0
branch 4 6 66.6
condition 2 3 66.6
subroutine 5 5 100.0
pod n/a
total 30 34 88.2


line stmt bran cond sub pod time code
1              
2             package UR::BoolExpr::Template::PropertyComparison::GreaterOrEqual;
3              
4 3     3   166 use strict;
  3         4  
  3         91  
5 3     3   10 use warnings;
  3         4  
  3         76  
6 3     3   10 use UR;
  3         4  
  3         31  
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 40     40   55 my ($class,$comparison_value,@property_value) = @_;
16 40         99 my $cv_is_number = Scalar::Util::looks_like_number($comparison_value);
17              
18 3     3   11 no warnings qw(numeric uninitialized);
  3         5  
  3         319  
19 40         62 foreach my $property_value ( @property_value ) {
20 40         60 my $pv_is_number = Scalar::Util::looks_like_number($property_value);
21              
22 40 100 66     123 if ($cv_is_number and $pv_is_number) {
23 24 50       124 return 1 if ( $property_value >= $comparison_value );
24             } else {
25 16 50       92 return 1 if ( $property_value ge $comparison_value );
26             }
27             }
28 0           return '';
29             }
30              
31              
32             1;
33              
34             =pod
35              
36             =head1 NAME
37              
38             UR::BoolExpr::Template::PropertyComparison::GreaterOrEqual - perform a greater than or equal test
39              
40             =head1 DESCRIPTION
41              
42             If the property returns multiple values, this comparison returns true if any of the values are greater
43             or equal to the comparison value
44              
45             =cut