On Tue, Feb 22, 2022, 13:55 Morse, Richard E.,MGH via Boston-pm <
[email protected]> wrote:

>
> > On Feb 22, 2022, at 12:12 PM, [email protected] wrote:
> >
> > ok, so, I need to read in some numbers from a file.
> > Numbers need to allow integer, float, signed/unsigned,
> > as well as supporting decimal, hex, binary, octal.
> >
> > Extra level of annoyance: using modules from cpan is difficult.
> > So, if it can be pure perl, all the better.
>
> You might look at Regexp::Common on CPAN. I know that you can’t use it
> directly, but it has a lot of tested regexes, and I don’t think it updates
> frequently. So you could probably either just pull the correct regexes out
> (or, it looks like, make it generate them for you), or just include the
> whole module, kit and caboodle, in some local lib directory as a part of
> your
>

Ricky speaks sense. Copying from Re:C is no worse than from StackExchange
or this  ailing list 😉

First though make a list of test cases - at least one for each numeric
format that works with string eval, and a bunch of the edge cases that eval
won't detect (hex digits without leading x, use of wrong locale's thousands
and decimal, other punctuation errors). You can mark the ones eval can't
detect as SKIP while running prove against the eval "$thing"; version.

(I.e., e.g., to wit, and viz, This is an ideal miniproject to dip a toe
into Test First Development / TDD)

>

_______________________________________________
Boston-pm mailing list
[email protected]
https://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to