File Coverage

blib/lib/Dist/Zilla/Role/FileInjector.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod 1 1 100.0
total 20 20 100.0


line stmt bran cond sub pod time code
1             # ABSTRACT: something that can add files to the distribution
2              
3             use Moose::Role;
4 46     46   28136  
  46         150  
  46         331  
5             use Dist::Zilla::Pragmas;
6 46     46   234754  
  46         125  
  46         339  
7             use namespace::autoclean;
8 46     46   348  
  46         154  
  46         350  
9             #pod =head1 DESCRIPTION
10             #pod
11             #pod This role should be implemented by any plugin that plans to add files into the
12             #pod distribution. It provides one method (C<L</add_file>>, documented below),
13             #pod which adds a file to the distribution, noting the place of addition.
14             #pod
15             #pod =method add_file
16             #pod
17             #pod $plugin->add_file($dzil_file);
18             #pod
19             #pod This adds a file to the distribution, setting the file's C<added_by> attribute
20             #pod as it does so.
21             #pod
22             #pod =cut
23              
24             my ($self, $file) = @_;
25             my ($pkg, undef, $line) = caller;
26 770     770 1 7441  
27 770         2520 $file->_set_added_by(
28             sprintf("%s (%s line %s)", $self->plugin_name, $pkg, $line),
29 770         22656 );
30              
31             $self->log_debug([ 'adding file %s', $file->name ]);
32             push @{ $self->zilla->files }, $file;
33 770         3327 }
34 770         33985  
  770         22386  
35             1;
36              
37              
38             =pod
39              
40             =encoding UTF-8
41              
42             =head1 NAME
43              
44             Dist::Zilla::Role::FileInjector - something that can add files to the distribution
45              
46             =head1 VERSION
47              
48             version 6.028
49              
50             =head1 DESCRIPTION
51              
52             This role should be implemented by any plugin that plans to add files into the
53             distribution. It provides one method (C<L</add_file>>, documented below),
54             which adds a file to the distribution, noting the place of addition.
55              
56             =head1 PERL VERSION
57              
58             This module should work on any version of perl still receiving updates from
59             the Perl 5 Porters. This means it should work on any version of perl released
60             in the last two to three years. (That is, if the most recently released
61             version is v5.40, then this module should work on both v5.40 and v5.38.)
62              
63             Although it may work on older versions of perl, no guarantee is made that the
64             minimum required version will not be increased. The version may be increased
65             for any reason, and there is no promise that patches will be accepted to lower
66             the minimum required perl.
67              
68             =head1 METHODS
69              
70             =head2 add_file
71              
72             $plugin->add_file($dzil_file);
73              
74             This adds a file to the distribution, setting the file's C<added_by> attribute
75             as it does so.
76              
77             =head1 AUTHOR
78              
79             Ricardo SIGNES 😏 <cpan@semiotic.systems>
80              
81             =head1 COPYRIGHT AND LICENSE
82              
83             This software is copyright (c) 2022 by Ricardo SIGNES.
84              
85             This is free software; you can redistribute it and/or modify it under
86             the same terms as the Perl 5 programming language system itself.
87              
88             =cut