Debug::Trace - Perl extension to trace subroutine calls
perl -MDebug::Trace=foo,bar yourprogram.pl
Debug::Trace instruments subroutines to provide tracing information upon every call and return.
Using Debug::Trace does not require any changes to your sources. Most often, it will be used from the command line:
This will have your subroutines foo() and bar() printing call and return information.
Subroutine names may be fully qualified to denote subroutines in other packages than the default main::.
By default, the trace information is output using the standard warn() function.
Modifiers can be inserted in the list of subroutines to change the default behavior of this module. All modifiers can be used in three ways:
:name to enable a specific feature.
:
:noname to disable a specific feature.
:no
:name(value) to set a feature to a specific value. In general, :name is equivalent to :name(1), while :noname corresponds to :name(0).
(
)
(1)
(0)
The following modifiers are recognized:
Uses warn() to produce the trace output (default). :nowarn Sends trace output directly to STDERR.
:nowarn
Add basic call information to the trace message, including from where the routine was called, and by whom. This is enabled by default.
Add a stack trace (call history).
Truncate the length of the lines of trace information to length characters.
The following modifiers can be used to control the way Data::Dumper prints the values of parameters and return values. See also Data::Dumper.
Controls the style of indentation. It can be set to 0, 1, 2 or 3. Style 0 spews output without any newlines, indentation, or spaces between list items. :indent(0) is the default.
:indent(0)
When enabled, uses double quotes for representing string values. Whitespace other than space will be represented as [\n\t\r], "unsafe" characters will be backslashed, and unprintable characters will be output as quoted octal integers. This is the default, use :nouseqq to disable.
[\n\t\r]
:nouseqq
Can be set to a positive integer that specifies the depth beyond which which we don't print structure contents. The default is 2, which means one level of array/hashes in argument lists and return values is expanded. If you use :nomaxdepth or :maxdepth(0), nested structures are fully expanded.
:nomaxdepth
:maxdepth(0)
Controls wether hash keys are always printed quoted. The default is :noquotekeys.
:noquotekeys
Controls whether hash keys are dumped in sorted order. The default is :nosortkeys.
:nosortkeys
Modifiers apply only to the subroutines that follow in the list of arguments.
None, actually. Everything is handled by the module's import.
Environment variable PERL5DEBUGTRACE can be used to preset initial modifiers, e.g.:
PERL5DEBUGTRACE
export PERL5DEBUGTRACE=":warn:indent(2):nomaxdepth:quotekeys"
Data::Dumper, Carp
Jan-Pieter Cornet <jpc@cpan.org>; Jos Boumans <kane@cpan.org>; Johan Vromans <jv@cpan.org>;
This is an Amsterdam.pm production. See http://amsterdam.pm.org.
Current maintainer is Johan Vromans <jv@cpan.org>.
Copyright 2002,2013 Amsterdam.pm. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Debug::Trace, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Debug::Trace
CPAN shell
perl -MCPAN -e shell install Debug::Trace
For more information on module installation, please visit the detailed CPAN module installation guide.