I don't want to seem to be defending this patch too vigorously, because I think
that if Larry had wanted Perl to be able to distinguish numbers from numberlike
strings he would have given us a way before B.
But the purity is not reduced by optionally requiring a *standard* XS module.
And the string eval happens once at startup, at minute cost compared to loading
PurePerl.pm, for example. Or one could do a 'constant'->import(...)
I've never used neat(), but if it's useful, maybe it needs another way to be
told whether a value is a number.
"Jeff Zucker" <[EMAIL PROTECTED]> on 04/12/2002 02:23:32 PM
To: John Tobey/Intdata@INTDATA, "dbi-dev" <[EMAIL PROTECTED]>
cc:
Subject: Re: DBI::PurePerl -- would you believe 100%?
[EMAIL PROTECTED] wrote:
>
> Very cool.
>
> Leaving aside the question whether anyone *should* tell the difference between
2
> and "2",
In this case, only to get PurePerl to act the same way as DBI when
putting quotes around values in neat(), not a large loss if it's
missing.
> here is one (untested) way to do it
Great, thanks!
> +BEGIN {
> + # Set inlinable constants based on feature tests.
> + local ($@);
> + if (eval { require B; }) {
Hmm, optionally requiring an XS module ... sort of takes the Pure out of
PurePerl :-).
> + eval ('sub HAVE_B () { 1 }');
Hmm, string eval ... I wonder if this feature is worth that price.
--
Jeff