Skip Menu |
 

This queue is for tickets about the Cache-Memcached-Managed CPAN distribution.

Report information
The Basics
Id: 29224
Status: resolved
Priority: 0/
Queue: Cache-Memcached-Managed

People
Owner: ELIZABETH [...] cpan.org
Requestors: wilburlo [...] gmail.com
Cc:
AdminCc:

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



Subject: version numeric/string confusion.
Hello, I was investigating a problem in which we couldn't get information out of the cache. After some head banging and an excellent imitation of a dog that just wouldn't give up on a bone... I found that there was some a problem in how we had referenced the version string. Our package defined $VERSION as such package Foo; $VERSION = "1.0"; --- The code called for $data = $cache->get( id => 'blah', key => 'blah', version => 1.0 ); The problem occurs because the get call requests version 1.0 which evaluates to 1; and the key join in sub _data_key $namespace.$delimiter.$version.$delimiter.$key; comes out as being ... "#1.0#" ... while the above get call evaluates to ... "#1#" ... I would like to suggest that you may want to "use version" as a way of preventing anyone from making the same mistake I did. :) http://search.cpan.org/~jpeacock/version-0.7203/lib/version.pod This package will "normalize" a version string and prevent any numeric/string oppsies. If you have any questions please feel free to contact me. Thank you! -daniel (woof woof!)
From: ELIZABETH [...] cpan.org
Download (untitled) / with headers
text/plain 1.5k
On Fri Sep 07 13:50:47 2007, DLO wrote: Show quoted text
> I was investigating a problem in which we couldn't get information > out of the cache. After some head banging and an excellent imitation of > a dog that just wouldn't give up on a bone... I found that there was > some a problem in how we had referenced the version string. Our package > defined $VERSION as such > > package Foo; > > $VERSION = "1.0"; > > --- > > The code called for > > $data = $cache->get( id => 'blah', key => 'blah', version => 1.0 );
Shouldn't version => "1.0", or: version => $VERSION, do the trick? I don't think the encountered problem is really related to $VERSION at all, but would cause the same problem if you would do: id => 1.0, or: key => 1.0, Show quoted text
> The problem occurs because the get call requests version 1.0 which > evaluates to 1; and the key join in sub _data_key > > $namespace.$delimiter.$version.$delimiter.$key; > > comes out as being > > ... "#1.0#" ... > while the above get call evaluates to > ... "#1#" ... > > I would like to suggest that you may want to "use version" as a way of > preventing anyone from making the same mistake I did. :) > > http://search.cpan.org/~jpeacock/version-0.7203/lib/version.pod > > This package will "normalize" a version string and prevent any > numeric/string oppsies.
Judging from all the traffic on p5p and the behaviour of "use version" on different versions of Perl, I'm a bit reluctant to add this dependency. Especially since the problem is not limited to version strings. Maybe a mention in the CAVEATS section would be more applicable? Liz
Download (untitled) / with headers
text/plain 660b
Show quoted text
> Judging from all the traffic on p5p and the behaviour of "use version" > on different versions of > Perl, I'm a bit reluctant to add this dependency. Especially since > the problem is not limited to > version strings. > > Maybe a mention in the CAVEATS section would be more applicable? >
I wasn't aware there is different behavior of "use version" on different versions of perl. Perhaps placing the warning in CAVEATS and placing a note to review the CAVEAT in the "version management" would be good? -daniel P.S. I've just noticed that "SYNOPSIS" uses "version => 1.1" as an float, while everywhere else in the documentation it is a string.
Caveat added, documentation adapted, in version 0.24 on its way to CPAN later today.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.