1Trace(3)              User Contributed Perl Documentation             Trace(3)
2
3
4

NAME

6       Devel::Trace - Print out each line before it is executed (like "sh -x")
7

SYNOPSIS

9         perl -d:Trace program
10

DESCRIPTION

12       If you run your program with "perl -d:Trace program", this module will
13       print a message to standard error just before each line is executed.
14       For example, if your program looks like this:
15
16               #!/usr/bin/perl
17
18
19               print "Statement 1 at line 4\n";
20               print "Statement 2 at line 5\n";
21               print "Call to sub x returns ", &x(), " at line 6.\n";
22
23               exit 0;
24
25
26               sub x {
27                 print "In sub x at line 12.\n";
28                 return 13;
29               }
30
31       Then  the "Trace" output will look like this:
32
33               >> ./test:4: print "Statement 1 at line 4\n";
34               >> ./test:5: print "Statement 2 at line 5\n";
35               >> ./test:6: print "Call to sub x returns ", &x(), " at line 6.\n";
36               >> ./test:12:   print "In sub x at line 12.\n";
37               >> ./test:13:   return 13;
38               >> ./test:8: exit 0;
39
40       This is something like the shell's "-x" option.
41

DETAILS

43       Inside your program, you can enable and disable tracing by doing
44
45           $Devel::Trace::TRACE = 1;   # Enable
46           $Devel::Trace::TRACE = 0;   # Disable
47
48       or
49
50           Devel::Trace::trace('on');  # Enable
51           Devel::Trace::trace('off'); # Disable
52
53       "Devel::Trace" exports the "trace" function if you ask it to:
54
55           import Devel::Trace 'trace';
56
57       Then if you want you just say
58
59           trace 'on';                 # Enable
60           trace 'off';                # Disable
61

TODO

63       •   You should be able to  send the trace output to the filehandle of
64           your choice.
65
66       •   You should be able to specify the format of the output.
67
68       •   You should be able to get the output into a string.
69
70       We'll see.
71

LICENSE

73       Devel::Trace 0.11 and its source code are hereby placed in the public
74       domain.
75

Author

77       Mark-Jason Dominus (C<mjd-perl-trace@plover.com>), Plover Systems co.
78       See the C<Devel::Trace.pm> Page at
79       http://www.plover.com/~mjd/perl/Trace for news and upgrades.
80
81
82
83perl v5.36.0                      2023-01-20                          Trace(3)
Impressum