Skip Menu |

This queue is for tickets about the IO-Prompt CPAN distribution.

Report information
The Basics
Id: 18652
Status: open
Priority: 0/
Queue: IO-Prompt

People
Owner: Nobody in particular
Requestors: Smylers [...] stripey.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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
Subject: Re: [rt.cpan.org #18652] -integer Permits 1e-3
Date: Wed, 12 Apr 2006 06:07:39 +1000
To: bug-IO-Prompt [...] rt.cpan.org
From: Damian Conway <damian [...] conway.org>
Show quoted text
> I think that the problem can be fixed by changing the pattern from: > > qr{[+-]? \d+ (?:[Ee][+-]?\d+ )?}x, > > to: > > qr{[+-]? \d+ (?:[Ee]+?\d+ )?}x,
It is indeed. And has been. Many thanks. Show quoted text
> 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 ...
"Do as I say, not as I do!" ;-) Damian