* Add enclair_db option to UserDB.pm. Allows logging of enclair password
[interchange.git] / code / OrderCheck / numeric.oc
1 # Copyright 2010 Interchange Development Group and others
2 #
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version. See the LICENSE file for details.
7
8 CodeDef numeric OrderCheck
9 CodeDef numeric Description Numeric
10 CodeDef numeric Routine <<EOR
11
12 sub {
13     my ($ref, $name, $value, $msg) = @_;
14     use Scalar::Util qw/looks_like_number/;
15
16     if (looks_like_number($value)) {
17         return (1, $name, '');
18     }
19     else {
20         return (0, $name, defined($msg) ? $msg : 'not numeric');
21     }
22 }
23 EOR