Subject: | -integer Permits 1e-3 |
Date: | Tue, 11 Apr 2006 13:42:35 +0100 |
To: | bug-io-prompt [...] rt.cpan.org |
From: | Smylers <Smylers [...] stripey.com> |
Hi again. I've spotted another tiny bug in IO::Prompt. The pattern for
matching integers (line 81 in version 0.99.4) permits negative
exponents, so allows through numbers such as 1e-3, which is of course
0.001 and not an integer.
I think that the problem can be fixed by changing the pattern from:
qr{[+-]? \d+ (?:[Ee][+-]?\d+ )?}x,
to:
qr{[+-]? \d+ (?:[Ee]+?\d+ )?}x,
Though I hear that for patterns for standard things like integers the
module Regexp::Common is available; I think I saw it recommended in some
book with a dog on the cover ...
Smylers