NAME
Module::Depakable - Check whether a module (or modules) is (are) depakable
VERSION
This document describes version 0.007 of Module::Depakable (from Perl distribution Module-Depakable), released on 2016-08-11.
FUNCTIONS
module_depakable(%args) -> [status, msg, result, meta]
Check whether a module (or modules) is (are) depakable.
Examples:
Example #1:
module_depakable(modules => ["Data::Sah", "WWW::PAUSE::Simple"]);
This routine tries to determine whether the module(s) you specify, when use-d by a script, won't impair the ability to depak the script so that the script can run with requiring only core perl modules installed. The word "depak-able" (depak) comes from the name of the application that can pack a script using fatpack/datapack technique.
Let's start with the aforementioned goal: making a script run with only requiring core perl modules installed. This is a pretty reasonable goal for a common use-case: deploying a Perl application to a fresh perl installation. All the non-core modules that the script might use are packed along inside the script using fatpack (put inside a hash variable) or datapack (put in the DATA section) technique. But XS modules cannot be packed using this technique. And therefore, a module that requires non-core XS modules (either directly or indirectly) also cannot be used.
So in other words, this routine checks that a module is PP (pure-perl) and all of its (direct and indirect) dependencies are PP or core.
To check whether a module is PP/XS, Module::XSOrPP
is used and this requires that the module is installed because Module::XSOrPP
guesses by analyzing the module's source code.
To list all direct and indirect dependencies of a module, lcpan
is used, so that application must be installed and run first to download and index a local CPAN/CPAN-like repository.
This function is not exported by default, but exportable.
Arguments ('*' denotes required arguments):
modules* => array[str]
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)
prereq_depakable(%args) -> [status, msg, result, meta]
Check whether prereq (and their recursive prereqs) are depakable.
This routine is exactly like module_depakable
except it allows the prereq(s) themselves to be core XS, while module_depakable
requires the modules themselves be pure-perl.
This function is not exported by default, but exportable.
Arguments ('*' denotes required arguments):
prereqs* => array[str]
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/Module-Depakable.
SOURCE
Source repository is at https://github.com/perlancar/perl-Module-Depakable.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Module-Depakable
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.
SEE ALSO
depakable, CLI for this module.
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2016 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.