* Add enclair_db option to UserDB.pm. Allows logging of enclair password
[interchange.git] / code / OrderCheck / email_only.oc
1 # Copyright 2005-2009 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 # $Id: email_only.oc,v 1.5 2009-01-28 07:38:26 racke Exp $
9
10 CodeDef email_only OrderCheck 1
11 CodeDef email_only Description Email address
12 CodeDef email_only Routine <<EOR
13 sub {
14         my($ref, $var, $val, $msg) = @_;
15         if($val and $val =~ /^[\040-\077\101-\176]+\@[-A-Za-z0-9.]+\.[A-Za-z]+$/) {
16                 return (1, $var, '');
17         }
18         else {
19                 return (undef, $var,
20                         $msg || errmsg("'%s' not an email address", $val )
21                 );
22         }
23 }
24 EOR