I set up to use Data::Printer from the debugger using
these instructions. It successfully rebound the debugger's
p() command, except that it prints the data
twice:
File foo.pl
#!/usr/bin/env perl
use v5.36;
say "Here is ~/.perldb:\n";
say qx(cat ~/.perldb);
my @xx = (qw/a b c d e/);
push @xx, [ 1,2,3 ];
my $foo = 1; # set breakpoint here and issue p @xx
say 'Show result of p @xx when issued from within program';
use Data::Printer;
p @xx;
Debug session:
$ perl -d ./foo.pl
Loading DB routines from perl5db.pl version 1.73
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
main::(./foo.pl:4): say "Here is ~/.perldb:\n";
DB<1> b 10
DB<2> c
Here is ~/.perldb:
use DB::Pluggable;
DB::Pluggable->run_with_config( \'[DataPrinter]' );
main::(./foo.pl:10): my $foo = 1; # use as breakpoint
DB<2> p @xx
[
[0] "a",
[1] "b",
[2] "c",
[3] "d",
[4] "e",
[5] [
[0] 1,
[1] 2,
[2] 3
]
]
[
[0] "a",
[1] "b",
[2] "c",
[3] "d",
[4] "e",
[5] [
[0] 1,
[1] 2,
[2] 3
]
]
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,
(I get the same result when I remove the last 3 lines from foo.pl).
Any idea how to fix this?