develooper Front page | perl.perl5.porters | Postings from July 2012

[perl #113894] Storable can't store VSTRINGs

Thread Previous | Thread Next
From:
Father Chrysostomos via RT
Date:
July 30, 2012 23:35
Subject:
[perl #113894] Storable can't store VSTRINGs
Message ID:
rt-3.6.HEAD-11172-1343716492-347.113894-15-0@perl.org
On Thu Jun 28 21:43:30 2012, sprout wrote:
> On Thu Jun 28 20:32:02 2012, doy@tozt.net wrote:
> >   use Storable 'dclone'
> >   my $copy = dclone(\v1.2.3);
> >   is(ref($copy), 'VSTRING');
> > 
> > This fails, because Storable serializes the vstring as just a normal
> >    string.
> > I've already added a TODO test for this in the Storable test suite.

I’ve fixed it with commits e00e3c3ee and 7e2a0d4586.

> In case you are planning to fix this, you might want to look at commit
> d036e907fea, which added vstring support to Data::Dumper.  Vstrings have
> been a bit buggy in earlier versions of perl (and Storable is
> dual-life).  In particular, ~v0 returns a scalar with vstring magic
> attached to it when it shouldn’t.  Data::Dumper detects that and treats
> it as not-a-vstring.

That did not actually matter, as Storable can store both the PV and the
magic PV, so what comes back is identical.

Data::Dumper can only store one (either "\1\2\3" or v1.2.3), so it has
to choose based on whether they actually match.

-- 

Father Chrysostomos


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org:443/rt3/Ticket/Display.html?id=113894

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About