demeter
demeter copied to clipboard
language localization causes problems with Moose LaxNum types
A localization like LANG=fr_FR calls for commas in place of dots in floats. For example,
sprintf("%.5f", $pi);
will print 3,15159
under that localization. That can trigger this error from Moose:
Attribute (parameter_name) does not pass the type constraint because:
Validation failed for 'LaxNum' with value 3,14159
A solution is to set LANG=en_US in the shell or subshell. It would be nice if Demeter could recognize this localization issue and alter its own environment accordingly.
Alternately, somehow redefine LaxNum (which uses looks_like_number) to accept either commas or dots.
See this thread and this thread from the mailing list.