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

Dist::Zilla::Plugin::Rinci::AddPrereqs - Add prerequisites from Rinci metadata

VERSION

This document describes version 0.145 of Dist::Zilla::Plugin::Rinci::AddPrereqs (from Perl distribution Dist-Zilla-Plugin-Rinci-AddPrereqs), released on 2020-06-10.

SYNOPSIS

In dist.ini:

 [Rinci::AddPrereqs]

DESCRIPTION

This plugin will first collect Rinci metadata from the following:

  • %SPEC variable in all modules of the distribution

  • Perinci::CmdLine scripts

    This plugin will also search all Perinci::CmdLine-based scripts, request Rinci function metadata from all local Riap URI's used by the scripts. Plus, will add a dependency to the module mentioned in the local Riap URI. For example, in Perinci::CmdLine-based script:

     url => '/MyApp/myfunc',

    The plugin will retrieve the Rinci metadata in MyApp module as well as add a runtime-requires dependency to the MyApp module (unless MyApp is in the same/current distribution).

Prereqs from Rinci function metadata

The following prereqs will be added according to information in Rinci function metadata.

  • Additional property module

    If the Rinci metadata contains non-standard properties, which require corresponding Perinci::Sub::Property::NAME modules, then these modules will be added as prereqs.

  • schema

    Currently will only do this for Rinci metadata for CLI scripts.

    The plugin will compile every schema of function argument using Data::Sah, then add a prereq to each module required by the generated argument validator produced by Data::Sah. For example, in Rinci metadata:

     args => {
         arg1 => {
             schema => 'color::rgb24*',
             ...
         },
         ...
     }

    When the color::rgb24 schema is compiled, the following modules are required: Sah::Schema::color::rgb24, Data::Sah::Coerce::perl::To_str::From_str::rgb24_from_colorname_X_or_code. The generated validator code requires these modules: strict, warnings, Graphics::ColorNames, Graphics::ColorNames::X. All of which will be added as prereq.

  • x.schema.entity, x.schema.element_entity

    Currently will only do this for Rinci metadata for CLI scripts.

    For every entity mentioned in x.schema.entity or x.schema.element_entity in argument specification in function metadata, the plugin will add a prereq to Perinci::Sub::ArgEntity::NAME. For example, in Rinci metadata:

     args => {
         arg1 => {
             'x.schema.entity' => 'dirname',
              ...
         },
         ...
     }

    (Note that x.schema.entity is deprecated.)

  • x.completion, x.element_completion

    For every completion mentioned in x.completion or x.element_completion in argument specification in function metadata, which can have the value of NAME or [NAME, ARGS], the plugin will add a prereq to corresponding Perinci::Sub::XCompletion::NAME. For example, in Rinci metadata:

     args => {
         arg1 => {
             'schema' => 'str*',
             'x.completion' => 'colorname',
             ...
         },
         ...
     }

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Dist-Zilla-Plugin-Rinci-AddPrereqs.

SOURCE

Source repository is at https://github.com/perlancar/perl-Dist-Zilla-Plugin-Rinci-AddPrereqs.

BUGS

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

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

Rinci

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020, 2019, 2018, 2016, 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.