NAME

Dist::Zilla::Plugin::MetaProvides::FromFile - Pull in hand-crafted metadata from a specified file.

VERSION

version 2.001002

SYNOPSIS

For a general overview of the MetaProvides family, see Dist::Zilla::Plugin::MetaProvides

This module is tailored to the situation where probing various files for provides data is not possible, and you just want to declare some in an external file.

[MetaProvides::FromFile]
inherit_version = 0         ; optional, default = 1
inherit_missing = 0         ; optional, default = 1
file = some_file.ini        ; required
reader_name = Config::INI::Reader ; optional, default = Config::INI::Reader
meta_no_index               ; optional, useless

And in some_file.ini

[Foo::Package]
file    = some/module/path
version = 0.1

OPTION SUMMARY

inherit_version

Shared Logic with all MetaProvides Plugins. See "inherit_version" in Dist::Zilla::Plugin::MetaProvides

inherit_missing

Shared Logic with all MetaProvides Plugins. See "inherit_missing" in Dist::Zilla::Plugin::MetaProvides

meta_no_index

Shared Logic with all MetaProvides Plugins. See "meta_no_index" in Dist::Zilla::Plugin::MetaProvides

However, given you're hard-coding the 'provides' map in the source file, and given that parameter is intended to exclude discovered modules from being indexed, it seems like the smart option would be to simply delete the unwanted entries from the source file.

file

Mandatory path to a file within your distribution, relative to the distribution root, to extract provides data from.

reader_name

A class that can be used to read the named file. Defaults to Config::INI::Reader.

It can be substituted by any class name that matches the following criteria

  • Can be instantiated via new

    my $instance = $reader_name->new();
  • has a read_file method on the instance

    my $result = $instance->read_file( ... )
  • read_file can take the parameter file

    my $result = $instance->read_file( file => 'path/to/file' )
  • read_file returns a hashref matching the following structure

    { 'Package::Name' => {
        file = 'path/to/file',
        version => '0.1',
    } }

ROLES

::Role::MetaProvider::Provider

PLUGIN FIELDS

file

type: required, ro, Str

reader_name

type: Str, ro.

default: Config::INI::Reader

PRIVATE PLUGIN FIELDS

_reader

type: Object, ro, built from "reader_name"

ROLE SATISFYING METHODS

provides

A conformant function to the ::Role::MetaProvider::Provider Role.

signature: $plugin->provides()

returns: Array of MetaProvides::ProvideRecord

BUILDER METHODS

_build__reader

SEE ALSO

AUTHOR

Kent Fredric <kentnl@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Kent Fredric <kentfredric@gmail.com>.

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