The JSON Perl libraries must be using one of the SvFLAGS on the Perl scalar
to determine its JavaScript type (string vs. integer).  While Perl scalars
don't have that distinction, they do have that internal SvFLAGS bits that
say how it was last accessed (~effectively).
So the Cache::Memcache code is touching it like a string, and that bit is
changing on your variable.  Then because you never tell the JSON Perl
library how to treat it, it uses the last-used-as bits on the Perl variable.

Fix, if it matters:  tell JSON.pm the types of your variables.  Don't rely
on error-prone detection by SvFLAGS.

On Mon, Dec 15, 2008 at 7:40 PM, jtal <[email protected]> wrote:

>
>
> Oh this might not be the right place for the question. I found this
> list on the CPAN page for Cache::Memcached.
>
> I have a perl subroutine that is printing out the JSON version of a
> perl data structure. Without the set() the data looks like this:
>
> (1111665600000, 2)
>
> WIth the set() it looks like:
>
> ("1111665600000", 2)
>
> The interesting thing is that I never get() the data. I just comment/
> uncomment the set() and see the double quoted strings show up or
> disappear.
>
> Thanks for any help. Sorry if this is the wrong place for this
> question.
>
> -j
>
>
> On Dec 15, 6:11 pm, Dustin <[email protected]> wrote:
> > On Dec 15, 3:50 pm, jtal <[email protected]> wrote:
> >
> > > I'm storing data structure that includes timestamps in the form of
> > > seconds from epoch. When I call set, a number like:
> >
> > > 1111665600000
> >
> > > becomes:
> >
> > > "1111665600000"
> >
> > > Notice it has become double quoted. There is no get() involved- only a
> > > set(). Anyone have any ideas?
> >
> >   It's not clear what you're doing.  What client API are you using?
> > How are you inspecting this data?
>

Reply via email to