Name : perl-Data-Constraint
| |
Version : 1.204
| Vendor : obs://build_opensuse_org/devel:languages:perl
|
Release : 1.5
| Date : 2024-08-05 20:12:19
|
Group : Unspecified
| Source RPM : perl-Data-Constraint-1.204-1.5.src.rpm
|
Size : 0.02 MB
| |
Packager : (none)
| |
Summary : prototypical value checking
|
Description :
A constraint is some sort of condition on a datum. This module checks one condition against one value at a time, and I call the thing that checks that condition the \"constraint\". A constraint returns true or false, and that\'s it. It should have no side effects, it should not change program flow, and it should mind its own business. Let the thing that calls the constraint figure out what to do with it. I want something that says \"yes\" or \"no\" (and I discuss why this needs a fancy module later).
For instance, the constraint may state that the value has to be a number. The condition may be something that ensures the value does not have non-digits.
$value =~ /^\\d+\\z/
The value may have additional constraints, such as a lower limit.
$value > $minimum
Although I designed constraints to be a single condition, you may want to create contraints that check more than one thing.
$value > $minimum and $value < $maximum
In the previous examples, we could tell what was wrong with the value if the return value was false: the value didn\'t satisfy it\'s single condition. If it was supposed to be all digits and wasn\'t, then it had non-digits. If it was supposed to be greater than the minimum value, but wasn\'t, it was less than (or equal to) the minimal value. With more than one condition, like the last example, I cannot tell which one failed. I might be able to say that a value of out of range, but I think it is nicer to know if the value should have been larger or smaller so I can pass that on to the user. Having said that, I give you enough rope to do what you wish.
|
RPM found in directory: /packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/devel:/languages:/perl:/CPAN-D/openSUSE_Tumbleweed/noarch |