in reply to Using Data::Printer from the Perl debugger

Oops! Sorry! Egg on face :-(

foo.pl contains use Data::Printer. The output format, in the examples below, has nothing to do with .perldb's contents or existence. I've stricken it all and, because it was quite long, put it in a spoiler.

Originally (i.e. prior to running the earlier tests) I did not have a ~/.perldb file. After posting, I was doing some cleanup and putting things back to the way they were. I did some checking. Curiously, regardless of whether that file was zero-length:

DB<2> c Here is ~/.perldb: main::(./foo.pl:10): my $foo = 1; # set breakpoint here and issue p + @xx

or removed completely:

DB<2> c Here is ~/.perldb: cat: /home/ken/.perldb: No such file or directory main::(./foo.pl:10): my $foo = 1; # set breakpoint here and issue p + @xx

The coloured and pretty-printed output persisted:

DB<2> p @xx abcdeARRAY(0xa004294d8) DB<3> c Show result of p @xx when issued from within program [ [0] "a", [1] "b", [2] "c", [3] "d", [4] "e", [5] [ [0] 1, [1] 2, [2] 3 ] ] Debugged program terminated. Use q to quit or R to restart,

This is the same output as I get with:

$ perl -E ' use Data::Printer; my @x = (qw{a b c d e}, [1,2,3]); say @x; p @x; ' abcdeARRAY(0xa00003bc8) [ [0] "a", [1] "b", [2] "c", [3] "d", [4] "e", [5] [ [0] 1, [1] 2, [2] 3 ] ]

For comparison, neither of these outputs are coloured:

$ perl -E ' use Data::Dumper; my @x = (qw{a b c d e}, [1,2,3]); say @x; print Dumper \@x; ' abcdeARRAY(0xa00003bc8) $VAR1 = [ 'a', 'b', 'c', 'd', 'e', [ 1, 2, 3 ] ];
$ perl -E ' use Data::Dump; my @x = (qw{a b c d e}, [1,2,3]); say @x; dd \@x; ' abcdeARRAY(0xa00003bc8) ["a" .. "e", [1, 2, 3]]

I don't know why the Data::Printer formatting is persisting in the debug output. Investigating why this happens may shed some light on the "prints twice" problem.

— Ken