Subject: | Strings of digits with preceding zeros (e.g. telnums) should be serialized as strings |
See subject. This is to avoid mutilation of data such as telephone
numbers, serial numbers, or any other such string of digits that may
have preceding zero characters.
The regular expression fixes are simple with an added negative
look-ahead for a "0", i.e. (?!0):
# In custom SOAP child class (if you use one):
sub new {
my $self = shift;
unless(ref($self)) {
$self = $self->SUPER::new(@_);
# ...snip...
my $typelookup = $self->serializer()->typelookup();
$typelookup->{'int'}->[1] = sub {$_[0] =~ /^(?!0)([+-]?\d{1,10})$/
&& ($1 <= 2147483647) && ($1 >= -2147483648); };
$typelookup->{'long'}->[1] = sub {$_[0] =~ /^(?!0)([+-]?\d{1,19})$/
&& ($1 <= 9223372036854775807); };
$typelookup->{'float'}->[1] = sub {$_[0] =~
/^(?!0)(-?(?:\d+(?:\.\d*)?|\.\d+|NaN|INF)|([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?)$/};
# ...snip...
}
return $self;
}