On Sat, Jun 23, 2012 at 1:14 PM, Flavio Poletti <polettix@gmail.com> wrote:
On Fri, Jun 22, 2012 at 9:50 PM, sawyer x <xsawyerx@gmail.com> wrote:
> I've been trying to write a test case for this, but have so far failed.

Which made me wonder whether the problem is being approached from the
wrong side. To make a long story short, I think that there should be a
bug filed to the JSON serializer. But I won't spare you the long story
:-)

When I tried to see what the whole thing is about, I wrote this:

   use Devel::Peek 'Dump';

   my $price = 100.55;

   Dump($price);
   print "$price\n";
   Dump($price);

That was actually very easy to do. But that's not what I wanted to do.

What I tried to do was to get any functionality in the Dancer::Logger to do it. I tried the abstract, and the console (which explicitly prints), but none of them were able to turn the NV to PV in my code. In fact, they had not changed it at all. The returned the same exact results.

 

So it's not a matter of getting a NV turned into a PV, but of getting
a NV turned into a NVPV whose NOK flag is still on - i.e. the contents
is still "number".

If this "evolution" can be obtained even through a single, simple
print, it seems to me that Dancer logging has actually nothing to do
with it and should not care. On the other hand, I think that the JSON
serializer should try better to guess how to cope with these
variables, going for the "number" when the contents are actually
numbers (i.e. testing the IOK and NOK flags before going for the
string).

Of course this might be a big mistake from my side... my assumption is
that what's actually happening is that a [IN]V is being turned into a
PV[IN]V, which might not be the case reported by Ovid. Sorry for the
noise in this case!

As usual, you out-researched us all. :)