File Coverage

blib/lib/Dist/Zilla/Plugin/InlineFiles.pm
Criterion Covered Total %
statement 25 25 100.0
branch 1 2 50.0
condition 1 3 33.3
subroutine 7 7 100.0
pod 0 1 0.0
total 34 38 89.4


line stmt bran cond sub pod time code
1             package Dist::Zilla::Plugin::InlineFiles 6.030;
2             # ABSTRACT: files in a data section
3              
4 12     12   16624 use Moose;
  12         35  
  12         80  
5             with 'Dist::Zilla::Role::FileGatherer';
6              
7 12     12   79135 use Dist::Zilla::Pragmas;
  12         41  
  12         90  
8              
9 12     12   116 use namespace::autoclean;
  12         39  
  12         88  
10              
11             #pod =head1 DESCRIPTION
12             #pod
13             #pod This plugin exists only to be extended, and gathers all files contained in its
14             #pod data section and those of its ancestors. For more information, see
15             #pod L<Data::Section|Data::Section>.
16             #pod
17             #pod =cut
18              
19 12     12   1098 use Sub::Exporter::ForMethods;
  12         46  
  12         183  
20             use Data::Section 0.200002 # encoding and bytes
21 12         93 { installer => Sub::Exporter::ForMethods::method_installer },
22 12     12   2944 '-setup' => { encoding => 'bytes' };
  12         423  
23 12     12   14433 use Dist::Zilla::File::InMemory;
  12         41  
  12         2866  
24              
25             sub gather_files {
26 23     23 0 84 my ($self) = @_;
27              
28 23         231 my $data = $self->merged_section_data;
29 23 50 33     5118 return unless $data and %$data;
30              
31 23         110 for my $name (keys %$data) {
32             $self->add_file(
33             Dist::Zilla::File::InMemory->new({
34             name => $name,
35 25         66 content => ${ $data->{$name} },
  25         1072  
36             }),
37             );
38             }
39              
40 23         238 return;
41             }
42              
43             __PACKAGE__->meta->make_immutable;
44             1;
45              
46             #pod =head1 SEE ALSO
47             #pod
48             #pod Core Dist::Zilla plugins inheriting from L<InlineFiles>:
49             #pod L<MetaTests|Dist::Zilla::Plugin::MetaTests>,
50             #pod L<PodCoverageTests|Dist::Zilla::Plugin::PodCoverageTests>,
51             #pod L<PodSyntaxTests|Dist::Zilla::Plugin::PodSyntaxTests>.
52             #pod
53             #pod =cut
54              
55             __END__
56              
57             =pod
58              
59             =encoding UTF-8
60              
61             =head1 NAME
62              
63             Dist::Zilla::Plugin::InlineFiles - files in a data section
64              
65             =head1 VERSION
66              
67             version 6.030
68              
69             =head1 DESCRIPTION
70              
71             This plugin exists only to be extended, and gathers all files contained in its
72             data section and those of its ancestors. For more information, see
73             L<Data::Section|Data::Section>.
74              
75             =head1 PERL VERSION
76              
77             This module should work on any version of perl still receiving updates from
78             the Perl 5 Porters. This means it should work on any version of perl released
79             in the last two to three years. (That is, if the most recently released
80             version is v5.40, then this module should work on both v5.40 and v5.38.)
81              
82             Although it may work on older versions of perl, no guarantee is made that the
83             minimum required version will not be increased. The version may be increased
84             for any reason, and there is no promise that patches will be accepted to lower
85             the minimum required perl.
86              
87             =head1 SEE ALSO
88              
89             Core Dist::Zilla plugins inheriting from L<InlineFiles>:
90             L<MetaTests|Dist::Zilla::Plugin::MetaTests>,
91             L<PodCoverageTests|Dist::Zilla::Plugin::PodCoverageTests>,
92             L<PodSyntaxTests|Dist::Zilla::Plugin::PodSyntaxTests>.
93              
94             =head1 AUTHOR
95              
96             Ricardo SIGNES 😏 <cpan@semiotic.systems>
97              
98             =head1 COPYRIGHT AND LICENSE
99              
100             This software is copyright (c) 2023 by Ricardo SIGNES.
101              
102             This is free software; you can redistribute it and/or modify it under
103             the same terms as the Perl 5 programming language system itself.
104              
105             =cut