File Coverage

lib/UR/BoolExpr/Template/PropertyComparison/LessThan.pm
Criterion Covered Total %
statement 16 17 94.1
branch 4 6 66.6
condition 2 3 66.6
subroutine 4 4 100.0
pod n/a
total 26 30 86.6


line stmt bran cond sub pod time code
1              
2             package UR::BoolExpr::Template::PropertyComparison::LessThan;
3              
4 266     266   973 use strict;
  266         309  
  266         6432  
5 266     266   860 use warnings;
  266         337  
  266         22914  
6             require 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 30     30   42 my ($class,$comparison_value,@property_value) = @_;
16 30         82 my $cv_is_number = Scalar::Util::looks_like_number($comparison_value);
17              
18 266     266   1024 no warnings 'uninitialized';
  266         343  
  266         23654  
19 30         47 foreach my $property_value ( @property_value ) {
20 30         45 my $pv_is_number = Scalar::Util::looks_like_number($property_value);
21              
22 30 100 66     93 if ($cv_is_number and $pv_is_number) {
23 18 50       117 return 1 if ( $property_value < $comparison_value );
24             } else {
25 12 50       65 return 1 if ( $property_value lt $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::LessThan - perform a less than test
39              
40             =head1 DESCRIPTION
41              
42             If the property returns multiple values, this comparison returns true if any of the values are
43             less than the comparison value
44              
45             =cut
46