* Don't autovifivy @fields array entries.
[interchange.git] / code / OrderCheck / numeric_strict.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_strict OrderCheck
9 CodeDef numeric_strict Description Numeric (strict)
10 CodeDef numeric_strict Routine <<EOR
11 sub {
12     my ($ref, $name, $value, $msg) = @_;
13
14     if (defined($value) and $value =~ /\A-?\d+(?:\.\d+)?\z/) {
15         return (1, $name, '');
16     }
17     else {
18         return (0, $name, defined($msg) ? $msg : 'not strict numeric');
19     }
20 }
21 EOR