Skip Menu |

This queue is for tickets about the Data-Dump-Streamer CPAN distribution.

Report information
The Basics
Id: 19060
Status: new
Priority: 0/
Queue: Data-Dump-Streamer

People
Owner: Nobody in particular
Requestors: dagolden [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 2.03-30
Fixed in: (no value)



Subject: Circular references with proxy objects fail round-trip test
A particular configuration of circular references and proxy objects fail a round-trip test. Test output below and test file attached. Test results generated on DDS 2.03-30 on Perl 5.8.8 WinXP VanillaPerl compiled with MinGW. ok 1 - Froze [ $b, $a, $c ] not ok 2 - Round-trip dump # Failed test 'Round-trip dump' # in dds_test.pl at line 27. # got: '$thaw = [ # bless( [ 'V: $thaw->[1]' ], 'List::Frozen' ), # bless( [], 'List::Frozen' ), # bless( [ # 'V: $thaw->[1]', # 'V: $thaw->[0]' # ], 'List::Frozen' ) # ]; # ' # expected: '$thaw = [ # bless( [ 'V: $thaw->[1]' ], 'List::Frozen' ), # bless( [], 'List::Frozen' ), # bless( [ # 'V: $thaw->[1]', # 'V: $thaw->[0]' # ], 'List::Frozen' ) # ]; # $thaw->[0]->DDS_thaw(); # $thaw->[1]->DDS_thaw(); # $thaw->[2][0] = $thaw->[1]; # $thaw->[2][1] = $thaw->[0]; # $thaw->[2]->DDS_thaw(); # ' 1..2 # Looks like you failed 1 test of 2. In particular, it appears that the fixes happen in the wrong order from the un-freezing. I think it should be: $thaw->[1]->DDS_thaw(); $thaw->[0][0] = $thaw->[1]; $thaw->[0]->DDS_thaw(); $thaw->[2][0] = $thaw->[1]; $thaw->[2][1] = $thaw->[0]; $thaw->[2]->DDS_thaw(); As a side-note, in 2.02, the order was different, but still wrong, with strange self assignments like: $thaw->[2][1] = $thaw->[2][1]; Or am I missing something in the way that I'm doing the round trip test?
Subject: dds_test.pl
#!perl use strict; use warnings; use Data::Dump::Streamer as => 'DDS' ; use Test::More 'no_plan'; my $dds = DDS->new ->Names("thaw") ->Verbose(1) ->Indent(2); my $a = List->new( ); my $b = List->new( $a ); my $c = List->new( $a, $b ); my $set = [ $b, $a, $c ]; my $frozen = $dds->Data( $set )->Out; ok( $frozen, 'Froze [ $b, $a, $c ]' ); my $thaw; eval $frozen; my $frozen2 = $dds->Data( [@$thaw] )->Out; is( $frozen2, $frozen, "Round-trip dump" ); package List; sub new { my $class = shift; bless [ @_ ], $class } sub DDS_freeze { my $self = shift; my $proxy = [ @$self ]; bless $proxy, "List::Frozen"; return ($proxy,'DDS_thaw'); } package List::Frozen; sub DDS_thaw { @$_[0] = @{ $_[0][0] }; bless $_[0], "List"; return $_[0]; }