The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Devel::TraceLoad - Trace loadings of Perl Programs

    # with perldb
    perl -d:TraceLoad script.pl

    # without perldb
    perl -MDevel::TraceLoad script.pl

    # without perldb and with options
    perl -MDevel::TraceLoad=after,path script.pl

    # with perldb and options
    perl -d:TraceLoad -MDevel::TraceLoad=stop,after,path script.pl

DESCRIPTION

The module Devel::TraceLoad traces the require() and the use() appearing in a program. The trace makes it possible to know the dependences of a program with respect to other programs and in particular of the modules.

The generated report can be obtained in various forms. The loadings are indicated in the order in which they are carried out. The trace can be obtained either during the execution of the loadings or the end of the execution. By default, the trace is generated during the execution and the overlaps of loadings are marked by indentations. All the require() are indicated, even if it is about a require() of a program already charged. A + indicates that the program is charged for the first time. A . indicates that the program was already charged.

When the trace is differed, the number of version of the modules is indicated. A differed trace can be sorted and if it is wished the names of the modules can be replaced by the absolute name of the files.

The module is close to Devel::Modlist but uses a redefinition of require() instead of exploiting %INC. In a will of homogeneity the module also borrows many things from Devel::Modlist.

USE

Devel::TraceLoad can be used with or without perldb:

    perl -d:TraceLoad script.pl

    perl -MDevel::TraceLoad script.pl

For the majority of the uses the two possibilities are equivalent.

OPTIONS

To pass from the options to the module Devel::TraceLoad one will write:

    perl -MDevel::TraceLoad=option1[,option2,...]

With this writing the option stop is not taken into account. So that stop is taken into account one will write:

    perl -d:TraceLoad -MDevel::TraceLoad=option1[,option2,...]
after

The trace is given at the end of the execution.

flat

Removes the indentations which indicate nestings of require().

noversion

Removes the indication of version of the necessary modules.

path

Indicates the absolute names of the files corresponding to the modules charged instead of names with modules.

This option functions only when the trace is produced at the end of the execution, i.e. in the presence of the option after.

sort

The trace is provided at the end of the execution and gives a list sorted alphabetically on the names of module or the paths.

stdout

Redirect the trace towards STDOUT. By defect the trace is redirected towards STDERR.

stop

Stop the program before the first of the program is not carried out if the execution with place with perldb. Does not allow to see the loadings carried out by the require() and the loadings which are in a eval().

try

If the execution fails with the message Can' T locate Bar.pm in @INC... and that you are sure of your code, use the option try. This option activates heuristics to compensate for the fact that it is not possible to know if the argument of a c<require() > is placed between quotation marks or not (I am mistaken?). To try to determine it we use heuristics which consists, amongst other things, to consider that the argument is placed between quotation marks if it is not suffixed by ".pl" or ".pm".

BUG

Some modules and pragmas are loaded because of the presence with -MDevel::TraceLoad. These modules do not appear in the trace (with the version of Perl on which we made our tests the modules concerned are Exporter.pm Carp.pm vars.pm warnings::register.pm Devel::TraceLoad.pm warnings.pm).

AUTHOR

Philippe Verdret < pverdret@dalet.com >, on the basis of idea of Joshua Pritikin < vishnu@pobox.com >.

the English version of documentation is produced from a machine translation carried out by babel.altavista.com.

Devel::Modlist.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 339:

Unknown directive: =HEAD1