Inkt/Role/WriteREADME.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 45 CC 3 SCAR 19.5
CC
3
Cov
0%
Build_README
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 7.0
1 package Dist::Inkt::Role::WriteREADME;
2  
3 our $AUTHORITY = 'cpan:TOBYINK';
4 our $VERSION = '0.026';
5  
6 use Moose::Role;
7 use Pod::Text;
8 use namespace::autoclean;
9  
10 has source_for_readme => (
11 is => 'ro',
12 lazy => 1,
13 default => sub { shift->lead_module },
14 );
15  
16 after BUILD => sub {
17 my $self = shift;
18 unshift @{ $self->targets }, 'README';
19 };
20  
21 sub Build_README
22 {
23 my $self = shift;
24
25 my $file = $self->targetfile('README');
26 $file->exists and return $self->log('Skipping %s; it already exists', $file);
27 $self->log('Writing %s', $file);
28
29 my $pod = 'Pod::Text'->new(
30 sentance => 0,
31 width => 78,
32 errors => 'die',
33 quotes => q[``],
34 utf8 => 1,
35 );
36
37 my $input = $self->source_for_readme;
38 unless ($input =~ /\.(pm|pod)$/)
39 {
40 $input =~ s{::}{/}g;
41 $input = "lib/$input.pm";
42 }
43 $input = $self->sourcefile($input);
44  
45 # inherit rights from input pod
46 $self->rights_for_generated_files->{'README'} ||= [
47 $self->_determine_rights($input)
48 ] if $self->can('_determine_rights');
49  
50 $pod->parse_from_file("$input", "$file");
51 }
52  
53 1;