我正在使用标准的Perl调试器来跟踪调用:
$ 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
如何将输出重定向到文件?
如果我做
PERLDB_OPTS="NonStop frame=1" perl -d test.pl > /dev/null 2>trace.txt
trace.txt
是空的。
在标准流(STDERR或STDOUT两者)上打印的调试输出看起来都不像。
使用Perl选项LineInfo = db.out输出到文件。
例:
PERLDB_OPTS="NonStop frame=1 LineInfo=db.out" perl -d ./test.pl
样本输出:
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.
有关更多信息,请访问https://perldoc.perl.org/perldebug.html#Configurable-Options
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句