Perl-Related Simple debugging tips

Source: Internet
Author: User
Tags perl script

Beginners Perl language, the first contact is not its syntax, but its debugging method, was due to a Perl script generated HTML page does not display properly, let me find out the cause of the problem, and then fix, was the first time to contact Perl, completely without any understanding, By virtue of learning a few words in the teriminal can be used in the debug command, quickly solve the problem, so, it is easy to debug Perl is very simple, as long as the use of the following sentences:
perl-d filename
This is a debug command that goes into Perl.

The following words will appear on the screen:
Enter h or ' h ' for help, or ' man perldebug ' for more help.
Main::(Filename:linenumber)
Linenumber:content;
Db<1>
FileName is the name of the file being debugged, LineNumber displays the line number of the current debug statement, and the content is the currently debugged statement,db<1> followed by a small black square cursor
1. You can enter n at this time, equivalent to F10 in Visual Studio, to the next sentence of debugging
2. If you want to run directly to the nth line statement, you can set a breakpoint at line N: B N (replace N with the line where you want to set the breakpoint)
Number), enter the breakpoint after the setting is successful, you can input l to see all the breakpoints set, do not want to see or can directly enter C,
Enter and run directly to the statement where the breakpoint is set.
3, want to delete the breakpoint can be B N (replace N with the line number that needs to set the breakpoint), enter after the line at the breakpoint is deleted,
You can also delete all breakpoints by B *
4, want to see the value of the variable, through the print variable name can be viewed
5, you can also directly change the value of the variables in the debug script by assigning values to the variables, such as direct input: $debug = 0, so
The value of $debug is assigned to 0.
6, exit debugging, as long as the input Q can
Other debugging methods can be learned by reading the Help file, enter H, just a few small commands, you can implement the Perl script
debugging, isn't it simple?

Perl-Related Simple debugging tips

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.