1 # Copyright 2005-2007 Interchange Development Group and others
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.
8 # $Id: length.oc,v 1.3 2007-03-30 23:40:48 pajamian Exp $
10 CodeDef length OrderCheck 1
11 CodeDef length Description String length
12 CodeDef length Routine <<EOR
14 my($ref, $name, $value, $msg) = @_;
15 $msg =~ s/^(\d+)(?:\s*-(\d+))?\s*//
19 my $len = length($value);
23 "%s length %s less than minimum length %s.",
27 return(0, $name, $msg);
29 elsif($max and $len > $max) {
31 "%s length %s more than maximum length %s.",
35 return(0, $name, $msg);
37 return (1, $name, '');