NAME

CPAN::Index::Role::Writable - Writes index files

DESCRIPTION

This role provides attributes and methods shared between classes that write index files.

REQUIRES

default_location

Class method that returns a string specifying the path to the default location of this file relative to the repository root.

__DATA__

Consuming packages are expected to have a DATA section that contains the template to use for generating the file contents.

PROVIDES

tarball_is_default

Required attribute. Boolean - indicates whether the file should be compressed by default. Automatically set to true if the file path in default_location ends in .gz.

repo_path

Optional attribute. Path to the repository root.

template

Optional attribute. The template to use for generating the index files. The default is fetched from the DATA section of the consuming package.

content

Optional attribute. The index file content. Built by default from the provided "template".

rebuild_content

content is a lazy read-only attribute which normally is built only once. Use rebuild_content to generate a new value for content if you've made changes to the list of packages.

write_to_file

This method builds the file content if necessary and writes it to a file. A path to a file to write to can be passed as an argument, otherwise the default location will be used (a .gz suffix, if it exists, will be removed).

write_to_tarball

This method builds the file content if necessary and writes it to a tarball. A path to a file to write to can be passed as an argument, otherwise the default location will be used.

write_to_default_location

This method builds the file content if necessary and writes it to the default location.