Debian Codegraph @

README

raw
1 NAME
2 Devel::Trace - Print out each line before it is executed (like `sh -x')
3
4 SYNOPSIS
5 perl -d:Trace program
6
7
8 DESCRIPTION
9 If you run your program with `perl -d:Trace program', this module will
10 print a message to standard error just before each line is executed. For
11 example, if your program looks like this:
12
13 #!/usr/bin/perl
14
15
16 print "Statement 1 at line 4\n";
17 print "Statement 2 at line 5\n";
18 print "Call to sub x returns ", &x(), " at line 6.\n";
19
20 exit 0;
21
22
23 sub x {
24 print "In sub x at line 12.\n";
25 return 13;
26 }
27
28
29 Then the `Trace' output will look like this:
30
31 >> ./test:4: print "Statement 1 at line 4\n";
32 >> ./test:5: print "Statement 2 at line 5\n";
33 >> ./test:6: print "Call to sub x returns ", &x(), " at line 6.\n";
34 >> ./test:12: print "In sub x at line 12.\n";
35 >> ./test:13: return 13;
36 >> ./test:8: exit 0;
37
38
39 This is something like the shell's `-x' option.
40
41 DETAILS
42 Inside your program, you can enable and disable tracing by doing
43
44 $Devel::Trace::TRACE = 1; # Enable
45 $Devel::Trace::TRACE = 0; # Disable
46
47
48 or
49
50 Devel::Trace::trace('on'); # Enable
51 Devel::Trace::trace('off'); # Disable
52
53
54 `Devel::Trace' exports the `trace' function if you ask it to:
55
56 import Devel::Trace 'trace';
57
58
59 Then if you want you just say
60
61 trace 'on'; # Enable
62 trace 'off'; # Disable
63
64
65 TODO
66 * You should be able to send the trace output to the filehandle of your
67 choice.
68
69 * You should be able to specify the format of the output.
70
71 * You should be able to get the output into a string.
72
73
74 We'll see.
75
76 Author
77 Mark-Jason Dominus (`[email protected]'), Plover Systems co.
78
79 See the `Devel::Trace.pm' Page at http://www.plover.com/~mjd/perl/Trace
80 for news and upgrades.
81