Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (23 sloc) 756 Bytes
# Copyright 2005-2007 Interchange Development Group and others
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version. See the LICENSE file for details.
CodeDef natural OrderCheck
CodeDef natural Description Natural number
CodeDef natural Routine <<EOR
sub {
my ($ref, $name, $value, $code) = @_;
if ($value and $value > 0 and "$value" eq int($value)) {
return (1, $name, '');
}
$code =~ s/\\/\\\\/g;
$code =~ s/^\s*(["'])(.+?)\1$/$2/;
if ($code =~ /\S/) {
return (0, $name, $code);
} else {
return (0, $name, 'no natural number');
}
}
EOR
You can’t perform that action at this time.