如何逐步运行Perl程序?

xyz*_*xyz 9 debugging perl

我有一个别人写的perl程序.当我运行它时,它默默地退出而不向日志文件写入任何内容.有没有办法我可以逐步运行这个Perl程序,由解释器逐行运行,从而看到它终止的位置?

pax*_*blo 25

是的,您可以调用Perl调试器perl -d.

文档可以在perldoc perldebugperldoc perldebtut中找到.

可能最有用的命令是:

s                 - step into current line.
n                 - step over current line.
r                 - step out of current function.
p <expr>          - print the expression.
b <line|subnm>    - sets a breakpoint
T                 - produce a stack trace.
c [<line|subnm>]  - continue running with optional one-time breakpoint.
h                 - help (for other commands).
Run Code Online (Sandbox Code Playgroud)