DEV Community

Bob Lied
Bob Lied

Posted on • Edited on

1

Perl debugger compactDump on by default

TLDR: sub afterinit { push @DB::typeahead, "o compactDump=1" }

When I use the Perl debugger, I usually want the compactDump option turned on. For reasons (?), I have never been able to set this option from the ~/.perldb file. It should be possible to set options by using lines like

...
parse_options("HistSize=100");
parse_options("compactDump=1");
...
Enter fullscreen mode Exit fullscreen mode

but when I try that with compactDump, starting up the debugger gives me a lot of unsightly warnings:

[~/]$ perl -d  -wE 'say "what"'
Variable "$frame" is not imported at (eval 6)[/Users/lied/perl5/perlbrew/perls/perl-5.38.0/lib/5.38.0/perl5db.pl:7578] line 2.
Variable "$doret" is not imported at (eval 6)[/Users/lied/perl5/perlbrew/perls/perl-5.38.0/lib/5.38.0/perl5db.pl:7578] line 3.
perldb: couldn't parse ./.perldb: Global symbol "$frame" requires explicit package name (did you forget to declare "my $frame"?) at (eval 6)[/Users/lied/perl5/perlbrew/perls/perl-5.38.0/lib/5.38.0/perl5db.pl:7578] line 2.
Global symbol "$doret" requires explicit package name (did you forget to declare "my $doret"?) at (eval 6)[/Users/lied/perl5/perlbrew/perls/perl-5.38.0/lib/5.38.0/perl5db.pl:7578] line 3.
Enter fullscreen mode Exit fullscreen mode

A close reading of some Stack Overflow articles and the perldoc perldebug documentation finally gave me a workaround. The following, added to ~/.perldb, will enable compactDump without the noise:

sub afterinit { push @DB::typeahead, "o compactDump=1" }
Enter fullscreen mode Exit fullscreen mode

This assumes that we are using GNU readline, which, of course we are.

Image of Datadog

How to Diagram Your Cloud Architecture

Cloud architecture diagrams provide critical visibility into the resources in your environment and how they’re connected. In our latest eBook, AWS Solution Architects Jason Mimick and James Wenzel walk through best practices on how to build effective and professional diagrams.

Download the Free eBook

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay