App::F...::Trace(3pm)
π App::FatPacker::Trace β the manual page, bestie edition π
okay so. this is App::FatPacker::Trace, a Perl module from the User Contributed Perl Documentation crew, section 3pm. she's a little tracing icon and she's about to tell you exactly which modules your code is out here loading. no cap. π΅οΈββοΈβ¨
πΈ NAME πΈ
App::FatPacker::Trace β tracing module usage using compilation checking π
β¨ SYNOPSIS β¨
# open STDERR for writing
# will be like: open my $fh, '>', '&STDERR'...
perl -MApp::FatPacker::Trace=>&STDERR myscript.pl
# open a file for writing
# will be like: open my $fh, '>>', 'fatpacker.trace'
perl -MApp::FatPacker::Trace=>>fatpacker.trace myscript.pl
like. that's the whole vibe. one line and she's already spilling everything your script touches. π₯
π¦ DESCRIPTION π¦
This module lets you trace the modules being used by your code. and the way she does it? clever trickery, bestie. she's using the "import" method, the "CHECK" block, and B's "minus_c" function. it's giving hacker girl main character energy and honestly? obsessed. π
So when App::FatPacker::Trace is being used, the import() method will call "B::minus_c" to set up the global compilation-only flag perl (the interpreter, not the language, keep up π«Ά) has. What does that flag do? It prevents any other code from being run. periodt. nothing runs past that point.
Then, in the "CHECK" block β which gets reached at the end of the compilation phase (peep perlmod if you wanna know more π) β she gathers up all modules that have been loaded, using %INC, and writes them out to a file or to STDERR. which one? determined by the parameters sent to the "import" method. you're in control, queen. π
π METHODS π
π import
This method gets run when you just load App::FatPacker::Trace. Here's what she does in order, no skipping:
- she notes the current
%INCπ - she sets up the output to be written to
- she raises the compilation-only flag, which prevents anything from being run past that point
and here's the thing: this flag cannot be unset. cannot. it's forever. π so the most easily way to run this is straight from the command line, like:
perl -MApp::FatPacker::Trace [...]
You can control the parameters to the import using an equal sign, like this:
# send the parameter "hello"
perl -MApp::FatPacker::Trace=hello [...]
# send the parameter ">&STDERR"
perl -MApp::FatPacker::Trace=>&STDERR [...]
The import method accepts a first parameter telling it which output to open and how. Both of those things β the output and the how β get sent in a single parameter. one param, two jobs. multitasking icon. β¨
# append to mytrace.txt
perl -MApp::FatPacker::Trace=>>mytrace.txt myscript.pl
# write to STDERR
perl -MApp::FatPacker::Trace=>&STDERR myscript.pl
The import method also accepts additional parameters of extra modules to load. She'll then add these modules to the trace. π«Ά
Why would you want that? Because sometimes you need to explicitly indicate additional modules to trace, even if they aren't actually used in your script. Maybe you're conditionally using them, maybe they're for additional features, maybe they're loaded lazily β whatever the reason, bestie, she's got you. no judgement. π
# Add Moo to the trace, even if you don't trace it in myscript.pl
perl -MApp::FatPacker::Trace=>&STDERR,Moo myscript.pl
π little reminder: that compilation-only flag from up top? she cannot be unset. so plan your one-liner before you fire it off, okay? π
and that's the whole page, angel. π§ this beauty ships with perl v5.36.0 and was dated 2022-11-20 β go forth and trace your little heart out. mwah. πππ¦
π¦ where this page comes from
- debian bookworm: libapp-fatpacker-perl 0.010008-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libapp-fatpacker-perl 0.010008-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libapp-fatpacker-perl 0.010008-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libapp-fatpacker-perl 0.010008-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libapp-fatpacker-perl 0.010008-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms