From: Rafael Kitover Date: Fri, 30 Apr 2010 11:01:26 +0000 (-0400) Subject: improve Informix default parsing X-Git-Tag: 0.07000~46 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5cd983b7a9e4da052d7ea8ceaa3ab16b2a5e9fe9;p=dbsrgits%2FDBIx-Class-Schema-Loader.git improve Informix default parsing --- diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Informix.pm b/lib/DBIx/Class/Schema/Loader/DBI/Informix.pm index a945018..01ca076 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Informix.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Informix.pm @@ -199,12 +199,11 @@ EOF $result->{$col}{default_value} = \$today; } else { - $default = (split ' ', $default)[-1]; + $default = (split ' ', $default, 2)[-1]; + $default =~ s/\s+\z//; # remove trailing 0s in floating point defaults - if (looks_like_number $default && int $default != $default) { - $default =~ s/0+\z//; - } + $default =~ s/0+\z// if $default =~ /^\d+\.\d+\z/; $result->{$col}{default_value} = $default; }