Storable: blessed long vstrings
authorFather Chrysostomos <sprout@cpan.org>
Tue, 31 Jul 2012 06:32:11 +0000 (23:32 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 31 Jul 2012 06:32:11 +0000 (23:32 -0700)
I made a mistake in the long vstring code.  The stored blessing was
being ignored.

dist/Storable/Storable.xs
dist/Storable/t/blessed.t

index 33f6850..eca061a 100644 (file)
@@ -4943,7 +4943,7 @@ static SV *retrieve_lvstring(pTHX_ stcxt_t *cxt, const char *cname)
        New(10003, s, len+1, char);
        SAFEPVREAD(s, len, s);
 
-       sv = retrieve(aTHX_ cxt, 0);
+       sv = retrieve(aTHX_ cxt, cname);
 
        sv_magic(sv,NULL,PERL_MAGIC_vstring,s,len);
        /* 5.10.0 and earlier seem to need this */
index 7c088e3..fe439ac 100644 (file)
@@ -30,6 +30,7 @@ use Storable qw(freeze thaw store retrieve);
     %::weird_refs = (
         REF     => \(my $aref    = []),
         VSTRING => \(my $vstring = v1.2.3),
+       'long VSTRING' => \(my $vstring = eval "v" . 0 x 300),
         LVALUE  => \(my $substr  = substr((my $str = "foo"), 0, 3)),
     );
 }
@@ -285,7 +286,7 @@ is(ref $t, 'STRESS_THE_STACK');
         my $thawn = thaw($frozen);
         # is_deeply ignores blessings
         is ref $thawn, ref $obj, "get the right blessing back for $weird";
-        if ($weird eq 'VSTRING') {
+        if ($weird =~ 'VSTRING') {
             # It is not just Storable that did not support vstrings. :-)
             # See https://rt.cpan.org/Ticket/Display.html?id=78678
             my $newver = "version"->can("new")