File Coverage

lib/Dist/Zilla/Plugin/Code/MetaProvider.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod 0 1 0.0
total 31 32 96.8


line stmt bran cond sub pod time code
1             package Dist::Zilla::Plugin::Code::MetaProvider;
2              
3 2     2   2064 use 5.006;
  2         12  
4 2     2   15 use strict;
  2         5  
  2         49  
5 2     2   9 use warnings;
  2         5  
  2         85  
6              
7             our $VERSION = '0.007';
8              
9 2     2   595 use Moose;
  2         495168  
  2         16  
10 2     2   14847 use namespace::autoclean;
  2         5  
  2         21  
11              
12             with 'Dist::Zilla::Role::MetaProvider';
13              
14 2     2   1044 use Config::MVP 2.200012 (); # https://github.com/rjbs/Config-MVP/issues/13
  2         216  
  2         77  
15 2     2   456 use MooseX::Types::Moose qw(CodeRef);
  2         56755  
  2         16  
16              
17             has metadata => (
18             is => 'ro',
19             isa => 'CodeRef',
20             reader => '_metadata',
21             required => 1,
22             );
23              
24             sub metadata {
25 2     2 0 99261 my $self = shift;
26              
27 2         91 my $code_ref = $self->_metadata;
28 2         15 return $self->$code_ref(@_);
29             }
30              
31             __PACKAGE__->meta->make_immutable;
32              
33             1;
34              
35             __END__
36              
37             =pod
38              
39             =encoding UTF-8
40              
41             =head1 NAME
42              
43             Dist::Zilla::Plugin::Code::MetaProvider - something that provides data to merge into the distribution metadata
44              
45             =head1 VERSION
46              
47             Version 0.007
48              
49             =head1 SYNOPSIS
50              
51             =head2 Dist::Zilla::Role::PluginBundle
52              
53             package Dist::Zilla::PluginBundle::MyBundle;
54              
55             use Moose;
56             with 'Dist::Zilla::Role::PluginBundle';
57              
58             sub bundle_config {
59             my ( $class, $section ) = @_;
60              
61             my @plugins;
62             push @plugins, [
63             'SomeUniqueName',
64             'Dist::Zilla::Plugin::Code::MetaProvider',
65             {
66             metadata => sub {
67             my ($self) = @_;
68             $self->log('Hello world');
69             },
70             },
71             ];
72              
73             return @plugins;
74             }
75              
76             =head2 Dist::Zilla::Role::PluginBundle::Easy
77              
78             package Dist::Zilla::PluginBundle::MyBundle;
79              
80             use Moose;
81             with 'Dist::Zilla::Role::PluginBundle::Easy';
82              
83             sub configure {
84             my ( $self ) = @_;
85              
86             $self->add_plugins([
87             'Code::MetaProvider',
88             {
89             metadata => sub {
90             my ($self) = @_;
91             $self->log('Hello world');
92             },
93             },
94             ]);
95              
96             return;
97             }
98              
99             =head1 DESCRIPTION
100              
101             This plugin implements the L<Dist::Zilla::Role::MetaProvider> role.
102              
103             =head1 SUPPORT
104              
105             =head2 Bugs / Feature Requests
106              
107             Please report any bugs or feature requests through the issue tracker
108             at L<https://github.com/skirmess/Dist-Zilla-Plugin-Code/issues>.
109             You will be notified automatically of any progress on your issue.
110              
111             =head2 Source Code
112              
113             This is open source software. The code repository is available for
114             public review and contribution under the terms of the license.
115              
116             L<https://github.com/skirmess/Dist-Zilla-Plugin-Code>
117              
118             git clone https://github.com/skirmess/Dist-Zilla-Plugin-Code.git
119              
120             =head1 AUTHOR
121              
122             Sven Kirmess <sven.kirmess@kzone.ch>
123              
124             =head1 COPYRIGHT AND LICENSE
125              
126             This software is Copyright (c) 2020-2021 by Sven Kirmess.
127              
128             This is free software, licensed under:
129              
130             The (two-clause) FreeBSD License
131              
132             =head1 SEE ALSO
133              
134             L<Dist::Zilla>, L<Dist::Zilla::Role::MetaProvider>
135              
136             =cut
137              
138             # vim: ts=4 sts=4 sw=4 et: syntax=perl