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