This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Gisle points out that it's ok to ignore the return value of newSVrv.
[perl5.git] / Porting / makemeta
CommitLineData
3e9ed10a
FD
1#!./perl -w
2# this script must be run by the current perl to get perl's version right
0cf51544
JH
3
4use strict;
5use warnings;
6use lib "Porting";
7
3e9ed10a
FD
8use File::Basename qw( dirname );
9
0cf51544
JH
10my $file = "META.yml";
11die "$0: will not override $file, delete it first.\n" if -e $file;
12
13use Maintainers qw(%Modules get_module_files get_module_pat);
14
15my @CPAN = grep { $Modules{$_}{CPAN} } keys %Modules;
16my @files = map { get_module_files($_) } @CPAN;
17my @dirs = grep { -d $_ } map { get_module_pat($_) } @CPAN;
18
3e9ed10a
FD
19my %dirs;
20@dirs{@dirs} = ();
21
22my $files = join '', map { " - $_\n" }
23 grep {
24 my $d = $_;
25 while(($d = dirname($d)) ne "."){
26 last if exists $dirs{$d};
27 }
28
29 # if $d is "." it means we tried every parent dir of the file and none
30 # of them were in the private list
31
32 $d eq ".";
33 }
34 sort { lc $a cmp lc $b } @files;
35
0cf51544
JH
36my $dirs = join '', map { " - $_\n" } sort { lc $a cmp lc $b } @dirs;
37
38open my $fh, ">$file" or die "Can't open $file: $!";
39
40print $fh <<"EOI";
41name: perl
42version: $]
43abstract: Practical Extraction and Reporting Language
44author: perl5-porters\@perl.org
45license: perl
46distribution_type: core
47private:
48 directory:
49$dirs
50 file:
51$files
52EOI
53
54close $fh;
55