The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::fatten - Pack your dependencies onto your script file

VERSION

This document describes version 0.38 of App::fatten (from Perl distribution App-fatten), released on 2015-05-15.

SYNOPSIS

This distribution provides command-line utility called fatten.

TODO

FUNCTIONS

fatten(%args) -> [status, msg, result, meta]

Pack your dependencies onto your script file.

Arguments ('*' denotes required arguments):

  • allow_xs => array[str]

  • args => array[str]

    Script arguments.

    Will be used when running your script, e.g. when trace_method is fatpacker or require. For example, if your script requires three arguments: --foo, 2, "bar baz" then you can either use:

     % fatten script output --args --foo --args 2 --args "bar baz"

    or:

     % fatten script output --args-json '["--foo",2,"bar baz"]'
  • debug_keep_tempdir => bool (default: 0)

    Keep temporary directory for debugging.

  • exclude => array[str]

    Modules to exclude.

    When you don't want to include a module, specify it here.

  • exclude_core => bool (default: 1)

    Whether to exclude core modules.

  • exclude_dist => array[str]

    Exclude all modules of dist.

    Just like the exclude option, but will exclude module as well as other modules from the same distribution. Module name must be the main module of the distribution. Will determine other modules from the .packlist file.

  • exclude_list => str

    Exclude modules from a list in a file.

  • exclude_pattern => array[str]

    Regex patterns of modules to exclude.

    When you don't want to include a pattern of modules, specify it here.

  • exclude_prereq => array[str]

    This option can be used to express that script will depend on a specified module, instead of including it fatpacked. The prereq-ed module, as well as other modules in the same distribution, as well as its prereqs and so on recursively, will be excluded from fatpacking as well.

    This option can be used to express dependency to an XS module, since XS modules cannot be fatpacked.

    To query dependencies, a local CPAN index is used for querying speed. Thus, this option requires that lcpan is installed and a fairly recent lcpan index is available.

  • include => array[str]

    Include extra modules.

    When the tracing process fails to include a required module, you can add it here.

  • include_dir => array[str]

    Include extra modules under directories.

  • include_dist => array[str]

    Include all modules of dist.

    Just like the include option, but will include module as well as other modules from the same distribution. Module name must be the main module of the distribution. Will determine other modules from the .packlist file.

  • include_list => str

    Include extra modules from a list in a file.

  • include_prereq => array[str]

    This option can be used to include a module, as well as other modules in the same distribution as that module, as well as the distribution's recursive dependencies, for fatpacking. Dependencies will be searched using a local CPAN index. This is a convenient alternative to tracing a module. So you might want to use this option together with setting trace_method to none.

    This option requires that lcpan is installed and a fairly recent lcpan index is available.

  • input_file => str (default: "-")

    Path to input file (script to be fatpacked).

    - (or if unspecified) means to take from standard input (internally, a temporary file will be created to handle this).

  • multiple_runs => array[hash]

    Pass to tracepm.

  • output_file => str

    Path to output file.

    If input is from stdin, then output defaults to stdout. You can also specify stdout by using -.

    Otherwise, defaults to <script>.fatpack in source directory. If source directory happens to be unwritable by the script, will try <script>.fatpack in current directory. If that fails too, will die.

  • overwrite => bool (default: 0)

    Whether to overwrite output if previously exists.

  • perl_version => str

    Perl version to target, defaults to current running version.

    This is for determining which modules are considered core and should be skipped by default (when exclude_core option is enabled). Different perl versions have different sets of core modules as well as different versions of the modules.

  • shebang => str (default: "/usr/bin/perl")

    Set shebang line/path.

  • skip_not_found => bool (default: 1)

    Instead of dying, skip when module to add is not found.

    This option is useful when you use include_prereq, because modules without its own .pm files will also be included (CPAN indexes packages, including those that do not have their own .pm files).

  • squish => bool (default: 0)

    Whether to squish included modules using Perl::Squish.

  • strip => bool (default: 0)

    Whether to strip included modules using Perl::Strip.

  • stripper => bool (default: 0)

    Whether to strip included modules using Perl::Stripper.

  • stripper_comment => bool (default: 1)

    Set strip_comment=1 (strip comments) in Perl::Stripper.

    Only relevant when stripping using Perl::Stripper.

  • stripper_log => bool (default: 0)

    Set strip_log=1 (strip log statements) in Perl::Stripper.

    Only relevant when stripping using Perl::Stripper.

  • stripper_maintain_linum => bool (default: 0)

    Set maintain_linum=1 in Perl::Stripper.

    Only relevant when stripping using Perl::Stripper.

  • stripper_pod => bool (default: 1)

    Set strip_pod=1 (strip POD) in Perl::Stripper.

    Only relevant when stripping using Perl::Stripper.

  • stripper_ws => bool (default: 1)

    Set strip_ws=1 (strip whitespace) in Perl::Stripper.

    Only relevant when stripping using Perl::Stripper.

  • test => bool

    Test the resulting output.

    Testing is done by running the resulting fatpacked result with perl -Mlib::core::only. To test, at least one test case is required (see --test-case-json). Test cases specify what arguments to give to program, what exit code we expect, and what the output should contain.

  • test_cases => array[hash]

    Example case:

     {"args":["--help"], "exit_code":0, "perl_args":["-Mlib::core::only"], "output_like":"Usage:"}
  • trace_extra_opts => hash

    Pass more options to `App::tracepm`.

  • trace_method => str (default: "fatpacker")

    Which method to use to trace dependencies.

    The default is fatpacker, which is the same as what fatpack trace does. Different tracing methods have different pro's and con's, one method might detect required modules that another method does not, and vice versa. There are several methods available, please see App::tracepm for more details.

    A special value of none is also provided. If this is selected, then fatten will not perform any tracing. Usually used in conjunction with --include-from.

  • use => array[str]

    Additional modules to "use".

    Will be passed to the tracer. Will currently only affect the fatpacker and require methods (because those methods actually run your script).

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

Return value: (any)

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/App-fatten.

SOURCE

Source repository is at https://github.com/perlancar/perl-App-fatten.

BUGS

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

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.

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by 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.