File Coverage

Makefile.PL
Criterion Covered Total %
statement 14 14 100.0
branch 1 2 50.0
condition n/a
subroutine 5 5 100.0
pod n/a
total 20 21 95.2


line stmt bran cond sub pod time code
1 1     1   240526 use strict;
  1         3  
  1         36  
2 1     1   4 use warnings;
  1         2  
  1         67  
3              
4 1     1   375 use ExtUtils::MM ();
  1         111839  
  1         46  
5 1     1   627 use File::Spec::Functions qw( catfile );
  1         573  
  1         473  
6              
7             my $git_base_url = 'https://codeberg.org/XSven';
8              
9             my $distname = 'Class-Enumeration';
10             # Transitions: unstable => testing => stable
11             my $release_status = 'stable';
12             # PRE_RELEASE_NUMBER is set by CI/CD pipeline
13             my $pre_release_extension = $release_status eq 'stable' ? undef : 'TRIAL' . ( $ENV{ PRE_RELEASE_NUMBER } // 1 );
14              
15             my @main_module_namespace = split /-/, $distname;
16             my $main_module = join '::', @main_module_namespace;
17             my $main_module_file = catfile( 'lib', @main_module_namespace ) . '.pm';
18             my $main_module_podfile = catfile( 'lib', @main_module_namespace ) . '.pod';
19             # We are not using
20             # VERSION_FROM => $main_module_file
21             # because we have to set the main module version in META_MERGE/provides too
22             my $main_module_version = MM->parse_version( $main_module_file );
23              
24             my %att = (
25             NAME => $main_module,
26             AUTHOR => 'Sven Willenbuecher ',
27             VERSION => $main_module_version,
28             ABSTRACT_FROM => $main_module_podfile,
29             # Another valid license string is "restricted"
30             # https://metacpan.org/pod/CPAN::Meta::Spec#license
31             LICENSE => 'perl_5',
32             MIN_PERL_VERSION => '5.010000',
33             DISTNAME => $distname,
34             DISTVNAME => join( '-', $distname, $main_module_version, $pre_release_extension // () )
35             , # Related to the below release_status metadata field
36             EXE_FILES => [ glob( join( ' ', map { catfile( $_, '*' ) } qw( bin script ) ) ) ],
37             META_MERGE => {
38             'meta-spec' => { version => 2 },
39             release_status => $release_status,
40             provides => {
41             $main_module => {
42             file => $main_module_file,
43             version => $main_module_version
44             },
45             join( '::', $main_module, 'Builder' ) => {
46             file => catfile( 'lib', @main_module_namespace, 'Builder' ) . '.pm',
47             version => $main_module_version
48             }
49             },
50             resources => {
51             repository => {
52             type => 'git',
53             url => "$git_base_url/$distname.git",
54             web => "$git_base_url/$distname"
55             },
56             bugtracker => {
57             web => "$git_base_url/$distname/issues"
58             }
59             }
60             },
61             # Check ExtUtils::MakeMaker Changes
62             NORECURS => 1,
63             NO_PERLLOCAL => 1,
64             clean => { FILES => "$distname*" },
65             dist => { TARFLAGS => 'cf', COMPRESS => 'gzip -9f', SUFFIX => 'gz' },
66             realclean => { FILES => 'cover_db local' },
67             test => { RECURSIVE_TEST_FILES => 1 }
68             );
69              
70             if ( caller() ) {
71             *WriteMakefile = sub {
72 1     1   4 my %args = @_;
73 1 50       37 @ARGV ? [ @args{ @ARGV } ] : \%args
74             }
75             } else {
76             require ExtUtils::MakeMaker::CPANfile;
77             ExtUtils::MakeMaker::CPANfile->import
78             }
79             WriteMakefile( %att )