Annotated edit history of
PerlNotes version 1 showing authors affecting page license.
View with all changes included.
| Rev |
Author |
# |
Line |
| 1 |
CraigBox |
1 |
This page contains some notes about the [Perl] programming language. We also have a page of useful PerlOneLiners. |
| |
|
2 |
|
| |
|
3 |
----- |
| |
|
4 |
|
| |
|
5 |
!! Trace execution in a [Perl] script |
| |
|
6 |
|
| |
|
7 |
Getting a trace showing each executed line of code in sequence (think <tt>sh -x</tt> but for [Perl] scripts) is not obvious. perl(1)'s <tt>-D</tt> switch itself does not provide such functionality, but you can get there like so: |
| |
|
8 |
|
| |
|
9 |
<verbatim> |
| |
|
10 |
$ PERLDB_OPTS="NonStop=1 AutoTrace=1 frame=2" perl -dS program |
| |
|
11 |
</verbatim> |
| |
|
12 |
|
| |
|
13 |
Another option is to install the [Devel::Trace | http://search.cpan.org/dist/Devel-Trace/] module and simply use it on the script using the <tt>-d:Trace</tt> argument: |
| |
|
14 |
|
| |
|
15 |
<verbatim> |
| |
|
16 |
$ perl -d:Trace program |
| |
|
17 |
</verbatim> |
| |
|
18 |
|
| |
|
19 |
This does not work everywhere, but is has the advantage that you can easily influence the amount of trace output from within the script. [Perl] developers will therefore probably prefer to use the module. |
| |
|
20 |
|
| |
|
21 |
----- |
| |
|
22 |
CategoryNotes |