NAME
Devel::TraceVars - Print each line of code with variables evaluated
SYNOPSIS
$ perl -d:TraceVars[+MODE[OPTIONS]] program [arguments]
Where MODE can be modules
or custom
.
If modules
mode is selected then the output will only include the lines that are provided by the given modules.
Modules can be added by separating them by commas ,
. By default the module main
is assumed to be included. Optionally, the wildcard *
can be used to indicate any module that matches the given pattern. Thus, the entry Net::SSH::*
will match all modules that start with Net::SSH.
NOTE: The wild card handling works only if it's used as the last character. Using the following pattern Net::*::Perl isn't supported yet.
If non-cpan
is used then output will exclude all files that are provided by CPAN. At present, a module is considered to be provided by CPAN if the module is loaded from the Perl include path as designated by $Config{installarchlib}.
If no mode is specified then all output lines are printed.
Examples:
perl -d:TraceVars script.pl
Prints all lines.
perl -d:TraceVars+modules script.pl
Defaults to print only all lines of the package main
which usually means all lines in the main program. The package main
is the default package used by perl when no package is specified in the code.
perl -d:TraceVars+modules,Net::SSH,Digest::* script.pl
Prints only information from the module Net::SSH
, and from any module whose name starts with Digest
.
perl -d:TraceVars+noncpan script.pl
Prints only lines that are provided by perl files that aren't stored in the default folder where all CPAN modules are installed.
DESCRIPTION
If you run your program with perl -d:TraceVars program
, this module will print the current line of code being executed to standard error just before each line is executed. The contents of all scalar variables will be evaluated and displayed as well. All leading and trailing spaces will be removed from each line.
METHODS
The following methods are available.
import
Called by perl when this module is first loaded.
DB::DB
This is the important part. Perl calls this method before each line is executed.
evaluate($package, $variable)
Tries to evaluate the content of the given variable.
$package
The package's scope where the variable was used.
$variable
The variable name to evaluate.
Returns the variable's content.
BUGS
Probably the code won't work with Perl's special variables. Sometimes perl seems to core dump when using this module.
SEE ALSO
AUTHOR
Emmanuel Rodriguez <potyl@cpan.org> based on a shameless copy of Devel::Trace
.