File Coverage

blib/lib/Dist/Zilla/Plugin/License.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 1 0.0
total 21 22 95.4


line stmt bran cond sub pod time code
1             package Dist::Zilla::Plugin::License 6.037;
2             # ABSTRACT: output a LICENSE file
3              
4 9     9   6876 use Moose;
  9         27  
  9         76  
5             with 'Dist::Zilla::Role::FileGatherer';
6              
7 9     9   64638 use Dist::Zilla::Pragmas;
  9         20  
  9         100  
8              
9 9     9   65 use namespace::autoclean;
  9         45  
  9         146  
10              
11             #pod =head1 DESCRIPTION
12             #pod
13             #pod This plugin adds a F<LICENSE> file containing the full text of the
14             #pod distribution's license, as produced by the C<fulltext> method of the
15             #pod dist's L<Software::License> object.
16             #pod
17             #pod =attr filename
18             #pod
19             #pod This attribute can be used to specify a name other than F<LICENSE> to be used.
20             #pod
21             #pod =cut
22              
23 9     9   3799 use Dist::Zilla::File::InMemory;
  9         103  
  9         1806  
24              
25             has filename => (
26             is => 'ro',
27             isa => 'Str',
28             default => 'LICENSE',
29             );
30              
31             sub gather_files {
32 9     9 0 34 my ($self, $arg) = @_;
33              
34 9         308 my $file = Dist::Zilla::File::InMemory->new({
35             name => $self->filename,
36             content => $self->zilla->license->fulltext,
37             });
38              
39 9         109 $self->add_file($file);
40 9         99 return;
41             }
42              
43             __PACKAGE__->meta->make_immutable;
44             1;
45              
46             #pod =head1 SEE ALSO
47             #pod
48             #pod =over 4
49             #pod
50             #pod =item *
51             #pod
52             #pod the C<license> attribute of the L<Dist::Zilla> object to select the license
53             #pod to use.
54             #pod
55             #pod =item *
56             #pod
57             #pod Dist::Zilla roles:
58             #pod L<FileGatherer|Dist::Zilla::Role::FileGatherer>.
59             #pod
60             #pod =item *
61             #pod
62             #pod Other modules:
63             #pod L<Software::License>,
64             #pod L<Software::License::Artistic_2_0>.
65             #pod
66             #pod =back
67             #pod
68             #pod =cut
69              
70             __END__
71              
72             =pod
73              
74             =encoding UTF-8
75              
76             =head1 NAME
77              
78             Dist::Zilla::Plugin::License - output a LICENSE file
79              
80             =head1 VERSION
81              
82             version 6.037
83              
84             =head1 DESCRIPTION
85              
86             This plugin adds a F<LICENSE> file containing the full text of the
87             distribution's license, as produced by the C<fulltext> method of the
88             dist's L<Software::License> object.
89              
90             =head1 PERL VERSION
91              
92             This module should work on any version of perl still receiving updates from
93             the Perl 5 Porters. This means it should work on any version of perl
94             released in the last two to three years. (That is, if the most recently
95             released version is v5.40, then this module should work on both v5.40 and
96             v5.38.)
97              
98             Although it may work on older versions of perl, no guarantee is made that the
99             minimum required version will not be increased. The version may be increased
100             for any reason, and there is no promise that patches will be accepted to
101             lower the minimum required perl.
102              
103             =head1 ATTRIBUTES
104              
105             =head2 filename
106              
107             This attribute can be used to specify a name other than F<LICENSE> to be used.
108              
109             =head1 SEE ALSO
110              
111             =over 4
112              
113             =item *
114              
115             the C<license> attribute of the L<Dist::Zilla> object to select the license
116             to use.
117              
118             =item *
119              
120             Dist::Zilla roles:
121             L<FileGatherer|Dist::Zilla::Role::FileGatherer>.
122              
123             =item *
124              
125             Other modules:
126             L<Software::License>,
127             L<Software::License::Artistic_2_0>.
128              
129             =back
130              
131             =head1 AUTHOR
132              
133             Ricardo SIGNES 😏 <cpan@semiotic.systems>
134              
135             =head1 COPYRIGHT AND LICENSE
136              
137             This software is copyright (c) 2026 by Ricardo SIGNES.
138              
139             This is free software; you can redistribute it and/or modify it under
140             the same terms as the Perl 5 programming language system itself.
141              
142             =cut