Why not the debugger? Is there something inimical to using -dT simultaneously? I tried it with afoken's script from the above-sited thread and got an interesting and informative look at how Data::Dumper implemented a hash dump of the envelope. One thing I like about running scripts like this is that I don't know what's gonna happen, and I need the output to make sense of the source:
$ perl -dT 1.dt.pl
Loading DB routines from perl5db.pl version 1.55
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
main::(1.dt.pl:7): say "this provides a solid entry point for debug
+ger";
DB<1> n
+
this provides a solid entry point for debugger
main::(1.dt.pl:9): print
main::(1.dt.pl:10): "Content-Type: text/plain\r\n\r\n",
main::(1.dt.pl:11): Data::Dumper->new( [ \%ENV ], ['*ENV'] )->Sor
+tkeys(1)->Useqq(1)->Dump();
DB<1> s
+
Data::Dumper::new(/usr/lib/x86_64-linux-gnu/perl/5.30/Data/Dumper.pm:7
+2):
72: my($c, $v, $n) = @_;
DB<1> v
+
69 # to cause output of arrays and hashes rather than refs.
70 #
71 sub new {
72==> my($c, $v, $n) = @_;
73
74: Carp::croak("Usage: PACKAGE->new(ARRAYREF, [ARRAYREF])")
75 unless (defined($v) && (ref($v) eq 'ARRAY'));
76: $n = [] unless (defined($n) && (ref($n) eq 'ARRAY'));
77
78: my($s) = {
DB<1> p @_
+
Data::DumperARRAY(0x55cf0af7c438)ARRAY(0x55cf0ae9e3e0)
...
DB<8> n
+
Data::Dumper::new(/usr/lib/x86_64-linux-gnu/perl/5.30/Data/Dumper.pm:7
+8):
78: my($s) = {
79: level => 0, # current recursive depth
80: indent => $Indent, # various styles of indentin
+g
81: trailingcomma => $Trailingcomma, # whether to add comma
+ after last elem
82: pad => $Pad, # all lines prefixed by this
+ string
83: xpad => "", # padding-per-level
84: apad => "", # added padding for hash key
+s n such
85: sep => "", # list separator
86: pair => $Pair, # hash key/value separator: def
+aults to ' => '
87: seen => {}, # local (nested) refs (id =>
+ [name, val])
88: todump => $v, # values to dump []
89: names => $n, # optional names for values
+[]
90: varname => $Varname, # prefix to use for tagging
+nameless ones
91: purity => $Purity, # degree to which output is
+evalable
92: useqq => $Useqq, # use "" for strings (backsl
+ashitis ensues)
93: terse => $Terse, # avoid name output (where f
+easible)
94: freezer => $Freezer, # name of Freezer method for
+ objects
95: toaster => $Toaster, # name of method to revive o
+bjects
96: deepcopy => $Deepcopy, # do not cross-ref, except t
+o stop recursion
97: quotekeys => $Quotekeys, # quote hash keys
98: 'bless' => $Bless, # keyword to use for "bless"
DB<8> n
+
Data::Dumper::new(/usr/lib/x86_64-linux-gnu/perl/5.30/Data/Dumper.pm:1
+08):
108: if ($Indent > 0) {
DB<8> n
+
Data::Dumper::new(/usr/lib/x86_64-linux-gnu/perl/5.30/Data/Dumper.pm:1
+09):
109: $s->{xpad} = " ";
DB<8> n
+
Data::Dumper::new(/usr/lib/x86_64-linux-gnu/perl/5.30/Data/Dumper.pm:1
+10):
110: $s->{sep} = "\n";
DB<8> n
+
Data::Dumper::new(/usr/lib/x86_64-linux-gnu/perl/5.30/Data/Dumper.pm:1
+12):
112: return bless($s, $c);
DB<8> p $s
+
HASH(0x55cf0b055668)
DB<9> p $c
+
Data::Dumper
DB<10> r
+
scalar context return from Data::Dumper::new: 'apad' => ''
'bless' => 'bless'
'deepcopy' => 0
...
'
'sortkeys' => 0
'terse' => 0
'toaster' => ''
'todump' => ARRAY(0x55cf0af7c438)
0 HASH(0x55cf0a6457a0)
'COLORTERM' => 'truecolor'
'DBUS_SESSION_BUS_ADDRESS' => 'unix:path=/run/user/1000/bus,guid
+=25f1c2dbc402335e5a6581fd60d50980'
...
'XDG_SESSION_TYPE' => 'x11'
'XMODIFIERS' => '@im=ibus'
'_' => '/usr/bin/perl'
'trailingcomma' => 0
'useperl' => 0
'useqq' => 0
'varname' => 'VAR'
'xpad' => ' '
Data::Dumper::Sortkeys(/usr/lib/x86_64-linux-gnu/perl/5.30/Data/Dumper
+.pm:716):
716: my($s, $v) = @_;
DB<10> c
+
Content-Type: text/plain
%ENV = (
"COLORTERM" => "truecolor",
...
"_" => "/usr/bin/perl"
);
Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
DB<10> q
I added a line of executable code to make a soft landing with the debugger. There's other ways to do it.
#!/usr/bin/perl -dT
use v5.030;
use warnings;
use Data::Dumper;
say "this provides a solid entry point for debugger";
print
"Content-Type: text/plain\r\n\r\n",
Data::Dumper->new( [ \%ENV ], ['*ENV'] )->Sortkeys(1)->Useqq(1)->Dum
+p();
Presumably, there is a Site.pm file on your system. Use the line
, and the debugger will start there. You're not limited to "walking." Try the M or y command and see how perl views your software.