我可以插入断点到源perl程序吗? [英] Can I insert break point into source perl program?

查看:109
本文介绍了我可以插入断点到源perl程序吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一些条件命中时perl程序启动调试器。一些其他语言有一个库支持的debug()语句,perl中是否有类似的语句?

解决方案

-d切换到脚本顶部的shebang行?像

 #!/ usr / bin / perl -d 
使用strict;
使用警告;
$ | = 1; $ \ =\\\


打印测试;

它确切地取决于它如何启动,但至少在简单的情况下,这应该启动调试器。



编辑:
然后您可以使用



<$在特定行上设置断点p $ p> > b [line] [条件]

并点击

 > c 

继续运行脚本 - 当条件满足时,调试器将停在指定的行


I want the perl program launch debugger when some condition hit. Some other language has debug() statement supported by library, is there any similar statement in perl?

解决方案

Have you tried adding the -d switch to the shebang line at the top of your script? Something like

#!/usr/bin/perl -d
use strict;
use warnings;
$|=1;$\="\n";

print "Test";

It really depends exactly how it gets launched, but at least in simple cases this should start the debugger.

Edit: You can then set a breakpoint on a specific line with a certain condition using

> b [line] [condition]

and hit

> c

to continue with running the script - the debugger will stop at the specified line when the condition is met

这篇关于我可以插入断点到源perl程序吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆