Subject: | [PATCH] Support for qr// in VALIDATE |
In AppConfig-1.56, the VALIDATE argument supports code references or
strings, the string assumed to be a regular expression. This patch
allows AppConfig to support qr// for VALIDATE.
$ perl -v
This is perl, v5.8.8 built for x86_64-linux-thread-multi
$ perl -le '$re = qr//; print ref $re'
Regexp
I have not investigated if this is correct for other versions of Perl.
Subject: | validate.diff |
--- AppConfig/State.pm 2006-10-26 06:48:51.000000000 -0700
+++ AppConfig/State.pm~ 2006-12-02 17:01:21.448237000 -0800
@@ -691,7 +691,7 @@
};
# non-ref (i.e. scalar)
- ref($validator) || do {
+ (ref($validator) eq 'Regexp' || !ref($validator)) && do {
# not a ref - assume it's a regex
return $value =~ /$validator/;
};