I'm using the standard Perl debugger to trace calls:
$ cat test.pl
sub test { print "Hello world" }
test();
$ PERLDB_OPTS="NonStop frame=1" perl -d test.pl > /dev/null
Package test.pl.
entering DB::Obj::_init
entering main::test
How to redirect output to file?
If I make
PERLDB_OPTS="NonStop frame=1" perl -d test.pl > /dev/null 2>trace.txt
trace.txt
is empty.
It doesn't look like that debug output printed on standard streams (STDERR or STDOUT both).
Use Perl option LineInfo=db.out to output to a file.
Example:
PERLDB_OPTS="NonStop frame=1 LineInfo=db.out" perl -d ./test.pl
Sample output:
entering CODE(0x14c53f0)
entering CODE(0x14ce788)
entering CODE(0x164f2a0)
entering strict::import
entering CODE(0x164f270)
entering warnings::import
entering CODE(0x16168b8)
entering CODE(0x16160f0)
entering CODE(0x15fc378)
entering CODE(0x1601a10)
Package /usr/share/perl5/warnings/register.pm.
More info at https://perldoc.perl.org/perldebug.html#Configurable-Options
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With