This module allows tracing the modules being used by your code. It does that
using clever trickery using the import method, the CHECK block and
Bs minus_c function.
When App::FatPacker::Trace is being used, the import() method will call
B::minus_c in order to set up the global compilation-only flag perl
(the interpreter) has. This will prevent any other code from being run.
Then in the CHECK block which is reached at the end of the compilation
phase (see perlmod), it will gather all modules that have been loaded,
using %INC, and will write it to a file or to STDERR, determined by
parameters sent to the import method.
This method gets run when you just load App::FatPacker::Trace. It will
note the current %INC and will set up the output to be written to, and
raise the compilation-only flag, which will prevent anything from being
run past that point. This flag cannot be unset, so this is most easily run
from the command line as such:
perl -MApp::FatPacker::Trace [...]
You can control the parameters to the import using an equal sign, as such:
# 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. These are both sent in a single parameter.
# 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 accepts additional parameters of extra modules to load.
It will then add these modules to the trace. This is helpful if you want
to explicitly indicate additional modules to trace, even if they arent
used in your script. Perhaps youre conditionally using them, perhaps
theyre for additional features, perhaps theyre loaded lazily, whatever
# Add Moo to the trace, even if you dont trace it in myscript.pl
perl -MApp::FatPacker::Trace=>&STDERR,Moo myscript.pl