Makefile.PL and Author.PL
[p5sagit/Module-Metadata.git] / Author.PL
1 use strict;
2 use warnings FATAL => 'all';
3
4 {
5   package MY;
6   push @ExtUtils::MakeMaker::Overridable, 'find_tests';
7   sub find_tests {
8     shift->SUPER::find_tests.' xt/*.t';
9   }
10 }
11
12 {
13   no warnings 'redefine';
14   sub WriteMakefile {
15     my %args = @_;
16     ExtUtils::MakeMaker::WriteMakefile(
17       %args,
18       AUTHOR => 'Ken Williams <kwilliams@cpan.org>, Randy W. Sims <RandyS@ThePierianSpring.org>',
19       ABSTRACT_FROM => $args{VERSION_FROM},
20     );
21   }
22 }
23
24 sub manifest_include {
25   use autodie;
26   my @files = @_;
27   my @parts;
28   while (my ($dir, $spec) = splice(@files, 0, 2)) {
29     my $re = ($dir ? $dir.'/' : '').
30       ((ref($spec) eq 'Regexp')
31         ? $spec
32         : !ref($spec)
33           ? ".*\Q${spec}\E"
34           : die "spec must be string or regexp, was: ${spec} (${\ref $spec})");
35     push @parts, $re;
36   }
37   my $final = '^(?!'.join('|', map "${_}\$", @parts).')';
38   open my $skip, '>', 'MANIFEST.SKIP';
39   print $skip "${final}\n";
40   close $skip;
41 }
42
43 manifest_include(
44   'lib' => '.pm',
45   't' => '.t',
46   't/lib' => '.pm',
47   '' => '.PL',
48   '' => qr{Changes|MANIFEST|README|META\.yml}
49 );
50
51 1;