Dist::Zilla::Role::ModuleMetadata - a role for plugins that use Module::Metadata
version 0.002
package Dist::Zilla::Plugin::YourNewPlugin; use Moose; with 'Dist::Zilla::Role::...', 'Dist::Zilla::Role::ModuleMetadata'; use namespace::autoclean; sub your_method { my $self = shift; my $file = ...; # perhaps via the :InstallModules filefinder? my $version = $self->module_metadata_for_file->($file)->version; ... }
This role provides some common utilities for Dist::Zilla plugins which use Module::Metadata and the information that it provides.
module_metadata_for_file
my $mmd = $self->module_metadata_for_file($file);
Given a dzil file object (anything that does Dist::Zilla::Role::File), this method returns a Module::Metadata object for that file's content.
Internally, this method caches these objects. If multiple plugins want an object for the same file, this avoids reparsing it.
Bugs may be submitted through the RT bug tracker (or bug-Dist-Zilla-Role-ModuleMetadata@rt.cpan.org). I am also usually active on irc, as 'ether' at irc.perl.org.
irc.perl.org
Module::Metadata
Karen Etheridge <ether@cpan.org>
This software is copyright (c) 2015 by Karen Etheridge.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Dist::Zilla::Role::ModuleMetadata, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dist::Zilla::Role::ModuleMetadata
CPAN shell
perl -MCPAN -e shell install Dist::Zilla::Role::ModuleMetadata
For more information on module installation, please visit the detailed CPAN module installation guide.