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?


In reply to Using Data::Printer from the Perl debugger by ibm1620

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.