File Coverage

blib/lib/Software/Policies/Contributing/PerlDistZilla.pm
Criterion Covered Total %
statement 28 29 96.5
branch 1 2 50.0
condition 4 4 100.0
subroutine 8 9 88.8
pod 1 3 33.3
total 42 47 89.3


line stmt bran cond sub pod time code
1             package Software::Policies::Contributing::PerlDistZilla;
2              
3 2     2   4399 use strict;
  2         4  
  2         90  
4 2     2   11 use warnings;
  2         5  
  2         118  
5 2     2   40 use 5.010;
  2         8  
6              
7             # ABSTRACT: Create project policy file: Contributing / PerlDistZilla
8              
9             our $VERSION = '0.002';
10              
11 2     2   17 use Carp;
  2         4  
  2         242  
12 2     2   623 use Data::Section -setup;
  2         21519  
  2         24  
13              
14             sub new {
15 3     3 1 9 my ($class) = @_;
16 3         11 return bless {}, $class;
17             }
18              
19             sub create {
20 3     3 0 13 my ( $self, %args ) = @_;
21 3   100     16 my $version = $args{'version'} // '1';
22 3   100     12 my $format = $args{'format'} // 'markdown';
23              
24 3         26 my ($data_section) = __PACKAGE__ =~ m/.+::([^:]+)$/msx;
25 3         10 my $data_section_label = $data_section . q{_v} . $version . q{_} . $format;
26 3         11 my $data = $self->section_data($data_section_label);
27 3 50       8896 croak "Cannot find data section $data_section_label"
28             if ( !$data );
29             return (
30             policy => 'Contributing',
31             class => 'PerlDistZilla',
32             version => $version,
33 3         8 text => ${$data},
  3         9  
34             filename => _filename($format),
35             format => $format,
36             );
37             }
38              
39             sub get_available_classes_and_versions {
40             return {
41 0     0 0 0 'Perl::Dist::Zilla' => {
42             versions => {
43             '1' => 1,
44             },
45             formats => {
46             'markdown' => 1,
47             'text' => 1,
48             },
49             },
50             };
51             }
52              
53             sub _filename {
54 3     3   7 my ($format) = @_;
55 3         16 my %formats = (
56             'markdown' => 'CONTRIBUTING.md',
57             'text' => 'CONTRIBUTING.txt',
58             );
59 3         84 return $formats{$format};
60             }
61              
62             1;
63              
64             =pod
65              
66             =encoding UTF-8
67              
68             =head1 NAME
69              
70             Software::Policies::Contributing::PerlDistZilla - Create project policy file: Contributing / PerlDistZilla
71              
72             =head1 VERSION
73              
74             version 0.002
75              
76             =for Pod::Coverage new create get_available_classes_and_versions
77              
78             =begin stopwords
79              
80              
81              
82              
83             =end stopwords
84              
85             =head1 METHODS
86              
87             =head2 new
88              
89             =head1 AUTHOR
90              
91             Mikko Koivunalho
92              
93             =head1 COPYRIGHT AND LICENSE
94              
95             This software is copyright (c) 2025 by Mikko Koivunalho.
96              
97             This is free software; you can redistribute it and/or modify it under
98             the same terms as the Perl 5 programming language system itself.
99              
100             =cut
101              
102             __DATA__