NAME
    App::tracepm - Trace dependencies of your Perl script

VERSION
    This document describes version 0.231 of App::tracepm (from Perl
    distribution App-tracepm), released on 2023-07-11.

SYNOPSIS
    This distribution provides command-line utility called tracepm.

FUNCTIONS
  tracepm
    Usage:

     tracepm(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Trace dependencies of your Perl script.

    This function is not exported.

    Arguments ('*' denotes required arguments):

    *   args => *array[str]*

        Script arguments.

    *   cache_prereqscanner => *bool* (default: 0)

        Whether cache Perl::PrereqScanner{,::Lite} result.

    *   core => *bool*

        Filter only modules that are in core.

    *   detail => *bool* (default: 0)

        Whether to return records instead of just module names.

    *   eval => *str*

        Specify script from command-line instead.

    *   method => *str* (default: "fatpacker")

        Tracing method to use.

        There are several tracing methods that can be used:

        *   "fatpacker" (the default): This method uses the same method that
            "fatpacker trace" uses, which is running the script using "perl
            -c" then collect the populated %INC. Only modules loaded during
            compile time are detected.

        *   "require": This method runs your script normally until it exits.
            At the start of program, it replaces CORE::GLOBAL::require()
            with a routine that logs the require() argument to the log file.
            Modules loaded during runtime is also logged by this method. But
            some modules might not work, specifically modules that also
            overrides require() (there should be only a handful of modules
            that do this though).

        *   "prereqscanner": This method does not run your Perl program, but
            statically analyze it using "Perl::PrereqScanner". Since it uses
            "PPI", it can be rather slow.

        *   "prereqscanner_recurse": Like "prereqscanner", but will recurse
            into all non-core modules until they are exhausted. Modules that
            are not found will be skipped. It is recommended to use the
            various "recurse_exclude_*" options options to limit recursion.

        *   "prereqscanner_lite": This method is like the "prereqscanner"
            method, but instead of "Perl::PrereqScanner" it uses
            "Perl::PrereqScanner::Lite". The latter does not use "PPI" but
            use "Compiler::Lexer" which is significantly faster.

        *   "prereqscanner_lite_recurse": Like "prereqscanner_lite", but
            recurses.

    *   module => *perl::modname*

        --module MOD is equivalent to --script 'use MOD'.

    *   multiple_runs => *array[hash]*

        Parameter to run script multiple times.

        A more general alternative to using "args". Script will be run
        multiple times, each with setting from element of this option.

        Can be used to reach multiple run pathways and trace more modules.

        Example:

         [{"args":["-h"]}, # help mode
          {"args":[""], "env":{"COMP_LINE":"cmd x", "COMP_POINT":5}},
         ],

    *   perl_version => *str*

        Perl version, defaults to current running version.

        This is for determining which module is core (the list differs from
        version to version. See Module::CoreList for more details.

    *   recurse_exclude => *array[str]*

        When recursing, exclude some modules.

    *   recurse_exclude_core => *bool*

        When recursing, exclude core modules.

    *   recurse_exclude_pattern => *array[str]*

        When recursing, exclude some module patterns.

    *   recurse_exclude_xs => *bool*

        When recursing, exclude XS modules.

    *   script => *filename*

        Path to script file.

    *   trap_script_output => *bool*

        Trap script output so it does not interfere with trace result.

    *   use => *array[str]*

        Additional modules to "use".

        This is like running:

         perl -MModule1 -MModule2 script.pl

    *   xs => *bool*

        Filter only modules that are XS modules.

    Returns an enveloped result (an array).

    First element ($status_code) is an integer containing HTTP-like status
    code (200 means OK, 4xx caller error, 5xx function error). Second
    element ($reason) is a string containing error message, or something
    like "OK" if status is 200. Third element ($payload) is the actual
    result, but usually not present when enveloped result is an error
    response ($status_code is not 2xx). Fourth element (%result_meta) is
    called result metadata and is optional, a hash that contains extra
    information, much like how HTTP response headers provide additional
    metadata.

    Return value: (any)

HOMEPAGE
    Please visit the project's homepage at
    <https://metacpan.org/release/App-tracepm>.

SOURCE
    Source repository is at <https://github.com/perlancar/perl-App-tracepm>.

AUTHOR
    perlancar <perlancar@cpan.org>

CONTRIBUTOR
    Steven Haryanto <stevenharyanto@gmail.com>

CONTRIBUTING
    To contribute, you can send patches by email/via RT, or send pull
    requests on GitHub.

    Most of the time, you don't need to build the distribution yourself. You
    can simply modify the code, then test via:

     % prove -l

    If you want to build the distribution (e.g. to try to install it locally
    on your system), you can install Dist::Zilla,
    Dist::Zilla::PluginBundle::Author::PERLANCAR,
    Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two
    other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps
    required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE
    This software is copyright (c) 2023, 2020, 2017, 2016, 2015, 2014 by
    perlancar <perlancar@cpan.org>.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

BUGS
    Please report any bugs or feature requests on the bugtracker website
    <https://rt.cpan.org/Public/Dist/Display.html?Name=App-tracepm>

    When submitting a bug or request, please include a test-file or a patch
    to an existing test-file that illustrates the bug or desired feature.

