[ic] [interchange] Add numeric ordercheck

Stefan Hornburg (Racke) racke at linuxia.de
Thu Mar 25 16:35:46 UTC 2010


Mike Heins wrote:
> Quoting Jon Jensen (jon at endpoint.com):
>> On Thu, 25 Mar 2010, Mike Heins wrote:
>>
>>> Hmm. This is no definition of numeric I know of.
>>>
>>> If it is for a SQL purpose, perhaps. I don't know enough to check that. 
>>> I will tell you MySQL and Postgres both accept +1, 1. and .1 just fine, 
>>> as does Perl.
>> Yes, we considered those but decided to make the check restrictive at 
>> least to start with. We can loosen it up if needed.
>>
>> The idea was that if validating a numeric entry from a customer, 1. is 
>> almost certainly missing something, +1 is not likely intentional, and .1 
>> we were on the fence about -- some cases it might be intentional, other 
>> times a mistake.
>>
>>> I think perhaps I would prefer:
>>>
>>> 	use Scalar::Util qw/looks_like_number/;
>> I could see using that. Ton, what do you think?
> 
> It's just that if we are going to put it in the distribution, we should
> correspond to an accepted definition of numeric or change the name to
> something that shows it isn't really numeric, but a modified definition.
> 
> Someone could easily spin their wheels thinking that something else was
> wrong, when it was just an unannounced and idiosyncratic definition of
> numeric.
> 

I agree. In general, I suggest that we think about a smarter solution for
order checks which are really regex checks.

RegexCheck numeric DEFINTIION

DEFINITION: just a regex or a named regex from Regexp::Common or so.

E.g.: http://search.cpan.org/perldoc?Regexp::Common::zip

Why should we care for zip regex's in Interchange at all?

Regards
          Racke


-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team




More information about the interchange-users mailing list