Debug::Trace(3pm)
π Debug::Trace β the perl one, from User Contributed Perl Documentation π
okay bestie, welcome to Debug::Trace, a Perl extension that traces your subroutine calls. yes it's a 3pm page, yes it's iconic, let's go π¦
β¨ NAME β¨
Debug::Trace β Perl extension to trace subroutine calls. that's it, that's the whole vibe.
πΈ SYNOPSIS πΈ
perl -MDebug::Trace=foo,bar yourprogram.pl
π DESCRIPTION π
so basically, Debug::Trace instruments subroutines so you get tracing info on every single call and every single return. every one. it's giving surveillance but make it helpful π
the best part? using Debug::Trace does not require any changes to your sources. not one. zero edits. you just show up and it works. most of the time you'll be running it straight from the command line:
perl -MDebug::Trace=foo,bar yourprogram.pl
and boom, your subroutines foo() and bar() start printing call and return information. obsessed.
subroutine names may be fully qualified to denote subroutines in other packages than the default main::. so like, you can point at subs that live somewhere else entirely, no cap.
by default, the trace information is output using the standard warn() function. β¨
π§ MODIFIERS π§
modifiers can be inserted in the list of subroutines to change the default behavior of this module. and here's the cute part: all modifiers can be used in three ways:
":"nameto enable a specific feature.":no"nameto disable a specific feature.":"name"("value")"to set a feature to a specific value. in general,":"nameis equivalent to":"name"(1), while":no"namecorresponds to":"name"(0).
the following modifiers are recognized:
:warnβ useswarn()to produce the trace output (default).":nowarn"sends trace output directly toSTDERR.:callerβ adds basic call information to the trace message, including from where the routine was called, and by whom. this one is enabled by default. π:stacktraceβ adds a stack trace (call history). receipts, basically.:maxlen(length)β truncates 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.
:indentβ controls the style of indentation. it can be set to0,1,2or3. style0spews output without any newlines, indentation, or spaces between list items.:indent(0)is the default.:useqqβ 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, so use":nouseqq"to disable.:maxdepth(depth)β can be set to a positive integer that specifies the depth beyond which which we don't print structure contents. the default is2, 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. π«Ά:quotekeysβ controls wether hash keys are always printed quoted. the default is":noquotekeys".sortkeysβ controls whether hash keys are dumped in sorted order. the default is":nosortkeys".
β οΈ heads up bestie: modifiers apply only to the subroutines that follow in the list of arguments. order matters, periodt.
π METHODS π
none, actually. everything is handled by the module's import. not a single method to your name and still the main character, we love that π
π ENVIRONMENT VARIABLES π
environment variable PERL5DEBUGTRACE can be used to preset initial modifiers, e.g.:
export PERL5DEBUGTRACE=":warn:indent(2):nomaxdepth:quotekeys"
β SEE ALSO β
Data::Dumper, Carp
π AUTHOR π
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 π
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.
and that's the whole page babes π this was pulled from perl v5.26.1, dated 2018-04-07, and yeah it's still serving. go trace something, you got this πβ¨π¦
π¦ where this page comes from
- debian bookworm: libdebug-trace-perl 0.05-2
- ubuntu jammy: libdebug-trace-perl 0.05-2
- ubuntu noble: libdebug-trace-perl 0.05-2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms