in reply to Re^5: In need of a Dumper that has no pretentions to being anything else.
in thread In need of a Dumper that has no pretentions to being anything else.
Here's something that takes your examples above, DDDumps them with Purity=1 and reevals the string and then shows the Streamer version of the original and of the evaled.
use Data::Dumper; use Data::Dump::Streamer; $Data::Dumper::Purity=1; my ($x,$y); $x=\$y; $y=\$x; test([$x, $y]); my $ary=[]; $ary->[0]=\$ary->[1]; $ary->[1]=\$ary->[0]; test($ary); sub test { my $VAR1; my $s = shift; my $d = Dumper($s); my $s2 = eval "$d;\$VAR1"; die $@ if $@; print "original---------------\n"; print Dump($s); print "DDed---------------\n"; print Dump($s2); print "\n" } __END__ original--------------- $ARRAY1 = [ \do { my $v = 'V: $ARRAY1->[1]' }, \do { my $v = 'V: $ARRAY1->[0]' } ]; ${$ARRAY1->[0]} = $ARRAY1->[1]; ${$ARRAY1->[1]} = $ARRAY1->[0]; DDed--------------- $ARRAY1 = [ \do { my $v = 'V: $ARRAY1->[1]' }, \do { my $v = 'V: $ARRAY1->[0]' } ]; ${$ARRAY1->[0]} = $ARRAY1->[1]; ${$ARRAY1->[1]} = $ARRAY1->[0]; original--------------- $ARRAY1 = [ 'R: $ARRAY1->[1]', 'R: $ARRAY1->[0]' ]; $ARRAY1->[0] = \$ARRAY1->[1]; $ARRAY1->[1] = \$ARRAY1->[0]; DDed--------------- $ARRAY1 = [ \do { my $v = 'V: $ARRAY1->[1]' }, \do { my $v = 'V: $ARRAY1->[0]' } ]; ${$ARRAY1->[0]} = $ARRAY1->[1]; ${$ARRAY1->[1]} = $ARRAY1->[0];
The first one comes out identical. The second one is not textually identical but if ${$x} = $y means the same thing as $x = \$y then I can't see what DD did wrong. Do they mean the same thing?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: In need of a Dumper that has no pretentions to being anything else.
by demerphq (Chancellor) on Feb 23, 2005 at 23:27 UTC | |
by fergal (Chaplain) on Feb 24, 2005 at 01:50 UTC | |
by BrowserUk (Patriarch) on Feb 24, 2005 at 04:26 UTC | |
by demerphq (Chancellor) on Feb 24, 2005 at 07:54 UTC |