如何使用EditPlus调试Perl程序


http://bbs.chinaunix.net/viewthread.php?tid=652761



晕~
你这哪叫调试。这个顶多只算是运行。而且还用错了。正确的用法是应该用 wperl.exe 而不是 perl.exe
perl -d 这才叫调试。


1. 希望你了解一些EditPlus的知识。
使用EditPlus来调试,我们一般是期望能够做为IDE来使用,通常,点下面提示信息输出窗口,如果有错误的提示信息,可以在代码编辑窗口直接定位。

2. perl -h的提示信息:

[Copy to clipboard] [ - ]
CODE:
D:/usr/bin>perl -h

Usage: D:/usr/bin/perl.exe [switches] [--] [programfile] [arguments]
  -0[octal]       specify record separator (//0, if no argument)
  -a              autosplit mode with -n or -p (splits $_ into @F)
  -C[number/list] enables the listed Unicode features
  -c              check syntax only (runs BEGIN and CHECK blocks)
  -d[:debugger]   run program under debugger
  -D[number/list] set debugging flags (argument is a bit mask or alphabets)
  -e program      one line of program (several -e's allowed, omit programfile)
  -F/pattern/     split() pattern for -a switch (//'s are optional)
  -i[extension]   edit <> files in place (makes backup if extension supplied)
  -Idirectory     specify @INC/#include directory (several -I's allowed)
  -l[octal]       enable line ending processing, specifies line terminator
  -[mM][-]module  execute `use/no module...' before executing program
  -n              assume 'while (<>) { ... }' loop around program
  -p              assume loop like -n but print line also, like sed
  -P              run program through C preprocessor before compilation
  -s              enable rudimentary parsing for switches after programfile
  -S              look for programfile using PATH environment variable
  -t              enable tainting warnings
  -T              enable tainting checks
  -u              dump core after parsing program
  -U              allow unsafe operations
  -v              print version, subversion (includes VERY IMPORTANT perl info)
  -V[:variable]   print configuration summary (or a single Config.pm variable)
  -w              enable many useful warnings (RECOMMENDED)
  -W              enable all warnings
  -x[directory]   strip off text before #!perl line and perhaps cd to directory
  -X              disable all warnings


D:/usr/bin>

perl -d,应该是交互式的,无法被EditPlus控制

QUOTE:
The Perl Debugger
If you invoke Perl with the -d switch, your script runs under the Perl source debugger. This works like an interactive Perl environment, prompting for debugger commands that let you examine source code, set breakpoints, get stack backtraces, change the values of variables, etc. This is so convenient that you often fire up the debugger all by itself just to test out Perl constructs interactively to see what they do.

3. ActivePerl的perldebug的DOC告诉我们:

QUOTE:
perldebug - Perl debugging  


NAME
DESCRIPTION
The Perl Debugger
Debugger Commands
Configurable Options
Debugger input/output
Debugging compile-time statements
Debugger Customization
Readline Support
Editor Support for Debugging
The Perl Profiler
Debugging regular expressions
Debugging memory usage
SEE ALSO
BUGS

--------------------------------------------------------------------------------


NAME
perldebug - Perl debugging



--------------------------------------------------------------------------------

DESCRIPTION
First of all, have you tried using the -w switch?

4. 找遍ActivePerl的DOC,我们找到了对wperl.exe的用法

QUOTE:
Miscellaneous Things
A full set of HTML documentation is installed, so you should be able to use it if you have a web browser installed on your system.

perldoc is also a useful tool for browsing information contained in the documentation, especially in conjunction with a pager like less (recent versions of which have Win32 support). You may have to set the PAGER environment variable to use a specific pager. ``perldoc -f foo'' will print information about the perl operator ``foo''.

One common mistake when using this port with a GUI library like Tk is assuming that Perl's normal behavior of opening a command-line window will go away. This isn't the case. If you want to start a copy of perl without opening a command-line window, use the wperl executable built during the installation process. Usage is exactly the same as normal perl on Win32, except that options like -h don't work (since they need a command-line window to print to).

5. 当然,如果要对代码进行深层次的调试,用perl -d是无可厚非的。



  

你可能感兴趣的:(other,perl,debugging,warnings,documentation,parsing,preprocessor)