1App::FatPacker::Trace(3U)ser Contributed Perl DocumentatiAopnp::FatPacker::Trace(3)
2
3
4

NAME

6       App::FatPacker::Trace - Tracing module usage using compilation checking
7

SYNOPSIS

9           # open STDERR for writing
10           # will be like: open my $fh, '>', '&STDERR'...
11           perl -MApp::FatPacker::Trace=>&STDERR myscript.pl
12
13           # open a file for writing
14           # will be like: open my $fh, '>>', 'fatpacker.trace'
15           perl -MApp::FatPacker::Trace=>>fatpacker.trace myscript.pl
16

DESCRIPTION

18       This module allows tracing the modules being used by your code. It does
19       that using clever trickery using the "import" method, the "CHECK" block
20       and B's "minus_c" function.
21
22       When App::FatPacker::Trace is being used, the import() method will call
23       "B::minus_c" in order to set up the global compilation-only flag perl
24       (the interpreter) has. This will prevent any other code from being run.
25
26       Then in the "CHECK" block which is reached at the end of the
27       compilation phase (see perlmod), it will gather all modules that have
28       been loaded, using %INC, and will write it to a file or to STDERR,
29       determined by parameters sent to the "import" method.
30

METHODS

32   import
33       This method gets run when you just load App::FatPacker::Trace. It will
34       note the current %INC and will set up the output to be written to, and
35       raise the compilation-only flag, which will prevent anything from being
36       run past that point. This flag cannot be unset, so this is most easily
37       run from the command line as such:
38
39           perl -MApp::FatPacker::Trace [...]
40
41       You can control the parameters to the import using an equal sign, as
42       such:
43
44           # send the parameter "hello"
45           perl -MApp::FatPacker::Trace=hello [...]
46
47           # send the parameter ">&STDERR"
48           perl -MApp::FatPacker::Trace=>&STDERR [...]
49
50       The import method accepts a first parameter telling it which output to
51       open and how. These are both sent in a single parameter.
52
53           # append to mytrace.txt
54           perl -MApp::FatPacker::Trace=>>mytrace.txt myscript.pl
55
56           # write to STDERR
57           perl -MApp::FatPacker::Trace=>&STDERR myscript.pl
58
59       The import method accepts additional parameters of extra modules to
60       load.  It will then add these modules to the trace. This is helpful if
61       you want to explicitly indicate additional modules to trace, even if
62       they aren't used in your script. Perhaps you're conditionally using
63       them, perhaps they're for additional features, perhaps they're loaded
64       lazily, whatever the reason.
65
66           # Add Moo to the trace, even if you don't trace it in myscript.pl
67           perl -MApp::FatPacker::Trace=>&STDERR,Moo myscript.pl
68
69
70
71perl v5.34.0                      2021-07-22          App::FatPacker::Trace(3)
Impressum