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

App::ModuleFeaturesUtils - CLI Utilities related to Module::Features

VERSION

This document describes version 0.006 of App::ModuleFeaturesUtils (from Perl distribution App-ModuleFeaturesUtils), released on 2021-08-31.

DESCRIPTION

This distribution includes the following utilities:

FUNCTIONS

check_feature_set_spec

Usage:

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

Check specification in %FEATURES_DEF in Modules::Features::* module.

Examples:

  • Check %FEATURES_DEF in Module::Features::TextTable:

    check_feature_set_spec(feature_set_name => "TextTable"); # -> [200, "OK", undef, { "func.warnings" => [] }]

This function is not exported.

Arguments ('*' denotes required arguments):

  • feature_set_data => hash

  • feature_set_name => perl::modulefeatures::modname

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)

check_features_decl

Usage:

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

Check %FEATURES in a module (or given in argument).

Examples:

  • Check feature declaration (%FEATURES) in a module:

    check_features_decl(module => "Text::Table::Sprintf"); # -> [200, undef, undef, {}]

This function is not exported.

Arguments ('*' denotes required arguments):

  • features_decl_data => hash

  • module => perl::modname

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)

check_module_features

Usage:

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

Check %FEATURES in a module and return the value of specified feature.

Examples:

  • Check all features declared in a module:

    check_module_features(module => "Text::Table::Sprintf");

    Result:

    [
      200,
      "OK",
      {
        TextTable => {
          can_align_cell_containing_color_code     => 0,
          can_align_cell_containing_newline        => 0,
          can_align_cell_containing_wide_character => 0,
          can_color                                => 0,
          can_color_theme                          => 0,
          can_colspan                              => 0,
          can_customize_border                     => 0,
          can_halign                               => 0,
          can_halign_individual_cell               => 0,
          can_halign_individual_column             => 0,
          can_halign_individual_row                => 0,
          can_hpad                                 => 0,
          can_hpad_individual_cell                 => 0,
          can_hpad_individual_column               => 0,
          can_hpad_individual_row                  => 0,
          can_rowspan                              => 0,
          can_set_cell_height                      => 0,
          can_set_cell_height_of_individual_row    => 0,
          can_set_cell_width                       => 0,
          can_set_cell_width_of_individual_column  => 0,
          can_use_box_character                    => 0,
          can_valign                               => 0,
          can_valign_individual_cell               => 0,
          can_valign_individual_column             => 0,
          can_valign_individual_row                => 0,
          can_vpad                                 => 0,
          can_vpad_individual_cell                 => 0,
          can_vpad_individual_column               => 0,
          can_vpad_individual_row                  => 0,
          speed                                    => "fast",
        },
      },
      {},
    ]
  • Check a single feature declared in a module:

    check_module_features(module => "Text::Table::Sprintf", feature_name => "speed");

    Result:

    [200, "OK", "fast", {}]

This function is not exported.

Arguments ('*' denotes required arguments):

  • feature_name => str

    Can be unqualified:

    feature_name

    or qualified with feature set name using the :: or / separator:

    Feature::SetName::feature_name
    Feature/SetName/feature_name
  • module* => perl::modname

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)

compare_module_features

Usage:

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

Return a table data comparing features from several modules.

Examples:

  • Compare features of two modules:

    compare_module_features(modules => ["Text::ANSITable", "Text::Table::More"]);

    Result:

    [
      200,
      "OK",
      [
        {
          "feature_set"       => "PerlTrove",
          "feature"           => "Development Status",
          "Text::ANSITable"   => "5 - Production/Stable",
          "Text::Table::More" => "4 - Beta",
        },
        {
          "feature_set"       => "PerlTrove",
          "feature"           => "Environment",
          "Text::ANSITable"   => "Console",
          "Text::Table::More" => "Console",
        },
        {
          "feature_set"       => "PerlTrove",
          "feature"           => "Intended Audience",
          "Text::ANSITable"   => ["Developers"],
          "Text::Table::More" => ["Developers"],
        },
        {
          "feature_set"       => "PerlTrove",
          "feature"           => "License",
          "Text::ANSITable"   => "OSI Approved :: Artistic License",
          "Text::Table::More" => "OSI Approved :: Artistic License",
        },
        {
          "feature_set"       => "PerlTrove",
          "feature"           => "Programming Language",
          "Text::ANSITable"   => "Perl",
          "Text::Table::More" => "Perl",
        },
        {
          "feature_set"       => "PerlTrove",
          "feature"           => "Topic",
          "Text::ANSITable"   => [
                                   "Software Development :: Libraries :: Perl Modules",
                                   "Utilities",
                                 ],
          "Text::Table::More" => [
                                   "Software Development :: Libraries :: Perl Modules",
                                   "Utilities",
                                 ],
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_align_cell_containing_color_code",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 1,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_align_cell_containing_newline",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 1,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_align_cell_containing_wide_character",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 1,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_color",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 0,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_color_theme",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 0,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_colspan",
          "Text::ANSITable"   => 0,
          "Text::Table::More" => 1,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_customize_border",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 1,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_halign",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 1,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_halign_individual_cell",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 1,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_halign_individual_column",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 1,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_halign_individual_row",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 1,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_hpad",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 0,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_hpad_individual_cell",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 0,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_hpad_individual_column",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 0,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_hpad_individual_row",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 0,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_rowspan",
          "Text::ANSITable"   => 0,
          "Text::Table::More" => 1,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_set_cell_height",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 0,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_set_cell_height_of_individual_row",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 0,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_set_cell_width",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 0,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_set_cell_width_of_individual_column",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 0,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_use_box_character",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 1,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_valign",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 1,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_valign_individual_cell",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 1,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_valign_individual_column",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 1,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_valign_individual_row",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 1,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_vpad",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 0,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_vpad_individual_cell",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 0,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_vpad_individual_column",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 0,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "can_vpad_individual_row",
          "Text::ANSITable"   => 1,
          "Text::Table::More" => 0,
        },
        {
          "feature_set"       => "TextTable",
          "feature"           => "speed",
          "Text::ANSITable"   => "slow",
          "Text::Table::More" => "slow",
        },
      ],
      {
        "table.fields" => [
          "feature_set",
          "feature",
          "Text::ANSITable",
          "Text::Table::More",
        ],
      },
    ]

This function is not exported.

Arguments ('*' denotes required arguments):

  • modules* => array[perl::modname]

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)

get_feature_set_spec

Usage:

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

Get feature set specification.

Examples:

  • Example #1:

    get_feature_set_spec(feature_set_name => "TextTable"); # -> [200, "OK", {}, {}]

This function is not exported.

Arguments ('*' denotes required arguments):

  • feature_set_name* => perl::modulefeatures::modname

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)

get_features_decl

Usage:

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

Get features declaration.

Examples:

  • Example #1:

    get_features_decl(module => "Text::Table::Tiny");

    Result:

    [
      200,
      "OK",
      {
        "features" => {
                        TextTable => {
                          can_align_cell_containing_color_code     => 1,
                          can_align_cell_containing_newline        => 0,
                          can_align_cell_containing_wide_character => 0,
                          can_color                                => 0,
                          can_color_theme                          => 0,
                          can_colspan                              => 0,
                          can_customize_border                     => 1,
                          can_halign                               => 1,
                          can_halign_individual_cell               => 0,
                          can_halign_individual_column             => 1,
                          can_halign_individual_row                => 0,
                          can_hpad                                 => 0,
                          can_hpad_individual_cell                 => 0,
                          can_hpad_individual_column               => 0,
                          can_hpad_individual_row                  => 0,
                          can_rowspan                              => 0,
                          can_set_cell_height                      => 0,
                          can_set_cell_height_of_individual_row    => 0,
                          can_set_cell_width                       => 0,
                          can_set_cell_width_of_individual_column  => 0,
                          can_use_box_character                    => 0,
                          can_valign                               => 0,
                          can_valign_individual_cell               => 0,
                          can_valign_individual_column             => 0,
                          can_valign_individual_row                => 0,
                          can_vpad                                 => 0,
                          can_vpad_individual_cell                 => 0,
                          can_vpad_individual_column               => 0,
                          can_vpad_individual_row                  => 0,
                          speed                                    => "medium",
                        },
                      },
        "module_v" => 1.02,
        "x.source" => "pm:Text::Table::Tiny::_ModuleFeatures",
      },
      {},
    ]

This function is not exported.

Arguments ('*' denotes required arguments):

  • module* => perl::modname

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)

list_feature_set_features

Usage:

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

List features in a feature set.

This function is not exported.

Arguments ('*' denotes required arguments):

  • detail => bool

    Return detailed record for each result item.

  • feature_set_name* => perl::modulefeatures::modname

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)

list_feature_sets

Usage:

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

List feature sets (in modules under Module::Features:: namespace).

Examples:

  • Example #1:

    list_feature_sets();

    Result:

    [
      200,
      "OK",
      ["Dummy", "PerlTrove", "PythonTrove", "TextTable"],
      {},
    ]
  • Show detail:

    list_feature_sets();

    Result:

    [
      200,
      "OK",
      ["Dummy", "PerlTrove", "PythonTrove", "TextTable"],
      {},
    ]

This function is not exported.

Arguments ('*' denotes required arguments):

  • detail => bool

    Return detailed record for each result item.

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-ModuleFeaturesUtils.

SOURCE

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

SEE ALSO

Module::Features

AUTHOR

perlancar <perlancar@cpan.org>

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, and sometimes one or two other Dist::Zilla plugin and/or Pod::Weaver::Plugin. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

This software is copyright (c) 2021 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-ModuleFeaturesUtils

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.