NAME

Dist::Zilla::Plugin::Manifest::Read - Read annotated source manifest

VERSION

Version v0.5.0, released on 2016-11-21 19:18 UTC.

WHAT?

Dist-Zilla-Plugin-Manifest-Read (or Manifest::Read for brevity) is a Dist::Zilla plugin. It reads annotated source manifest, checks existence of all listed files and directories, and adds selected files to the distribution. Manifest::Read also does FileFinder role, providing the list of files for other plugins.

This is Dist::Zilla::Plugin::Manifest::Read module documentation. Read this if you are going to hack or extend Manifest::Read, or use it programmatically.

If you want to have annotated source manifest, read the user manual. General topics like getting source, building, installing, bug reporting and some others are covered in the README.

SYNOPSIS

In your plugin:

# Iterate through the distribution files listed in MANIFEST:
my $finder = $self->zilla->plugin_named( 'Manifest::Read/:AllFiles' );
for my $file ( @{ $finder->find_files() } ) {
    ...
};

DESCRIPTION

This class consumes Dist::Zilla::Role::FileGatherer and Dist::Zilla::Role::FileFinder roles. In order to fulfill requirements, the class implements gather_files and find_files methods. Other methods are supporting.

The class also consumes Dist::Zilla::Role::ErrorLogger role. It allows the class not to stop at the first problem but continue and report multiple errors to user.

OBJECT ATTRIBUTES

manifest_name

Name of manifest file to read.

Str, read-only, default value is MANIFEST, init_arg is manifest.

manifest_file

Manifest file as a Dist::Zilla file object (Dist::Zilla::File::OnDisk).

Object, read-only.

_incl_file_set

Set of files (object which do Dist::Zilla::Role::File role) listed in the manifest and marked for inclusion to the distribution.

_manifest_bulk

Parsed manifest. HashRef. Keys are file names, values are HashRefs to inner hashes. Each inner hash has keys and associated values:

name

Parsed filename (single-quoted filenames are unquoted, escape sequences are evaluated, if any).

file

Object which does Dist::Zilla::Role::File role.

mark

Mark.

comment

File comment, leading and trailing whitespaces are stripped.

line

Number of manifest line the file listed in.

HasfRef, read-only, lazy, initialized with builder.

_manifest_lines

Array of chomped manifest lines, including comments and empty lines.

ArrayRef[Str], read-only, lazy, initialized with builder.

OBJECT METHODS

BUILD

This method creates bunch of file finders: Manifest::Read/:AllFiles, Manifest::Read/:ExecFiles, Manifest::Read/:ExtraTestFiles, Manifest::Read/:IncModules, Manifest::Read/:InstallModules, Manifest::Read/:NoFiles, Manifest::Read/:PerlExecFiles, Manifest::Read/:ShareFiles, Manifest::Read/:TestFiles.

gather_files

This method fulfills Dist::Zilla::Role::FileGatherer role requirement. It adds files listed in manifest to distribution. Files marked to exclude from distribution and directories are not added.

find_files

This method fulfills Dist::Zilla::Role::FileFinder role requirement. It returns the complete list (strictly speaking, arrayref) of files read from the manifest, in order of appearance.

Note: The list includes files which are not added to the distribution.

Note: The method always returns the same list of files. Plugins which remove files from distribution (i. e. plugins which do Dist::Zilla::Role::FilePruner role) do not affect result of the method.

If you are interested in distribution files, have look to file finders generated by BUILD.

_parse_lines

This method parses manifest lines. Each line is parsed separately (there is no line continuation).

If the method fails to parse a line, error is reported by calling method log_error (implemented in Dist::Zilla::Role::ErrorLogger). This means that parsing is not stopped at the first failure, but entire manifest will be parsed and all the found errors will be reported.

The method returns list of hashrefs, a hash per file. Each hash has following keys and values:

name

Parsed filename (single-quoted filenames are unquoted, escape sequences are evaluated, if any).

mark

Mark.

comment

File comment, leading and trailing whitespaces are stripped.

line

Number of manifest line (one-based) the file is listed in.

SEE ALSO

Dist::Zilla
Dist::Zilla::Role::FileGatherer
Dist::Zilla::Role::ErrorLogger

AUTHOR

Van de Bugger <van.de.bugger@gmail.com>

COPYRIGHT AND LICENSE

Copyright (C) 2015, 2016 Van de Bugger

License GPLv3+: The GNU General Public License version 3 or later <http://www.gnu.org/licenses/gpl-3.0.txt>.

This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.