in reply to Reinventing the wheel: Dumper Difficulties

While you're at it, fix the bug I mention in my p5p bug report, which is a difficult one to fix.

-- Randal L. Schwartz, Perl hacker

  • Comment on •Re: Reinventing the wheel: Dumper Difficulties

Replies are listed 'Best First'.
Re: •Re: Reinventing the wheel: Dumper Difficulties
by demerphq (Chancellor) on Apr 10, 2002 at 15:58 UTC
    Well, I dont support Dumper style variable naming, I do a Dump style do{} output instead. But heres your two cases. From what I can tell they come out correctly. Let me know if they are wrong.

    UPDATE
    Doh. I shouldhave read your bugreport more carefully. Obviously both of these are incorrect in the respect that you mention. But i'm pretty sure that I can resolve that. Ill let you know.

    Oh and thanks, I've been meaning to get the Dumper test cases and run them through BFDump, but keep forgetting. So now that I've been reminded the download is running... ;-)

    use Data::BFDump qw(BFDump); my @dogs = ( 'Fido', 'Wags' ); my %kennel = ( First => \$dogs[0], Second => \$dogs[1], ); $dogs[2] = \%kennel; my $mutts = \%kennel; print "BFDump(\\\@dogs, \\\%kennel, \$mutts);\n"; print BFDump(\@dogs, \%kennel, $mutts),"\n\n"; print "BFDump(\\\%kennel, \\\@dogs, \$mutts);\n"; print BFDump(\%kennel, \@dogs, $mutts),"\n"; __END__ BFDump(\@dogs, \%kennel, $mutts); do { my $RT_ARRAY = [ 'Fido', 'Wags', {} ]; my $RT_HASH = { First => \do { my $v = 'Fido' }, Second => \do { my $v = 'Wags' } }; $RT_ARRAY->[2] = $RT_HASH; ( $RT_ARRAY, $RT_HASH, $RT_HASH ) } BFDump(\%kennel, \@dogs, $mutts); do { my $RT_HASH = { First => \do { my $v = 'Fido' }, Second => \do { my $v = 'Wags' } }; my $RT_ARRAY = [ 'Fido', 'Wags', $RT_HASH ]; ( $RT_HASH, $RT_ARRAY, $RT_HASH ) }
    Oh and if anyone is wondering what the RT means in the variable names, it stands for root.

    Yves / DeMerphq
    ---
    Writing a good benchmark isnt as easy as it might look.