收集的Perl Debug方法
Perl Debug The concepts of the perl debug are familiar to most programmers. Trace,breakpoint,and conditional breakpoint (watchpoint) are effective means with which to find problems in your perl script. Common errors in perl Check for these common errors before you try to debug a program:
Using the -w switch perl -w myprogram Both this useful command and the output from this command are frequently overlooked by experienced programmers. I have,on more than one occasion,spent an hour or 2 looking for a problem when correcting the errors displayed on the -w switch would have corrected or led me to the correction of the problem in a couple of minutes. The debug command perl -d myprogram Essentially the -d switch allows you to communicate with the perl executable,and allows the perl executable to communicate with you. Stepping up to the plate
Breaking away Breakpoints allow you to specify the next stopping point in a program. For example,lets say I know my problems at line 65,I might insert a breakpoint at line 60 and step through the final five lines of code before the problem. You just saved hitting the enter key 60 times. b - Set a breakpoint Once you have started the perl debugger you may set a breakpoint at any executable line number. b 20 - Sets a breakpoint at line 20.
Examples To start the program use c (continue),which runs the program to the first breakpoint or watchpoint. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |