logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Dist::Zilla::Role::ModuleMetadata - A role for plugins that use Module::Metadata

Author

       Karen Etheridge <ether@cpan.org>

Description

       This role provides some common utilities for Dist::Zilla plugins which use Module::Metadata and the
       information that it provides.

Methods Provided

"module_metadata_for_file"
           my $mmd = $self->module_metadata_for_file($file, @options);

       Given a dzil file object (anything that does Dist::Zilla::Role::File), this method returns a
       Module::Metadata object for that file's content. Any extra arguments are passed along to
       "new_from_handle" in Module::Metadata.

       Internally, this method caches these objects. If multiple plugins want an object for the same file, this
       avoids reparsing it.

Name

       Dist::Zilla::Role::ModuleMetadata - A role for plugins that use Module::Metadata

See Also

       •   Module::Metadata

Support

       Bugs may be submitted through the RT bug tracker <https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-
       Zilla-Role-ModuleMetadata>   (or  bug-Dist-Zilla-Role-ModuleMetadata@rt.cpan.org  <mailto:bug-Dist-Zilla-
       Role-ModuleMetadata@rt.cpan.org>).

       There   is   also   a   mailing    list    available    for    users    of    this    distribution,    at
       <http://dzil.org/#mailing-list>.

       There  is also an irc channel available for users of this distribution, at "#distzilla" on "irc.perl.org"
       <irc://irc.perl.org/#distzilla>.

       I am also usually active on irc, as 'ether' at "irc.perl.org".

Synopsis

           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, collect_pod => 1)->version;
               ...
           }

Version

       version 0.006

See Also