« blib/lib/UR/BoolExpr/Template/PropertyComparison/LessOrEqual.pm
↑ Summary
blib/lib/UR/BoolExpr/Template/PropertyComparison/NotBetween.pm »
| 1 | |||
| 2 | package UR::BoolExpr::Template::PropertyComparison::LessThan; | ||
| 3 | |||
| 4 | use strict; | ||
| 5 | use warnings; | ||
| 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 | my ($class,$comparison_value,@property_value) = @_; | ||
| 16 | my $cv_is_number = Scalar::Util::looks_like_number($comparison_value); | ||
| 17 | |||
| 18 | no warnings 'uninitialized'; | ||
| 19 | foreach my $property_value ( @property_value ) { | ||
| 20 | my $pv_is_number = Scalar::Util::looks_like_number($property_value); | ||
| 21 | |||
| 22 | if ($cv_is_number and $pv_is_number) { | ||
| 23 | return 1 if ( $property_value < $comparison_value ); | ||
| 24 | } else { | ||
| 25 | return 1 if ( $property_value lt $comparison_value ); | ||
| 26 | } | ||
| 27 | } | ||
| 28 | 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 |