use File::Basename qw( dirname );
+
+BEGIN {
+ # Get function prototypes
+ require 'regen_lib.pl';
+}
+
+
my $file = "META.yml";
-die "$0: will not override $file, delete it first.\n" if -e $file;
+my $new_file = "META.yml-new";
use Maintainers qw(%Modules get_module_files get_module_pat);
my $dirs = join '', map { " - $_\n" } sort { lc $a cmp lc $b } @dirs;
-open my $fh, ">$file" or die "Can't open $file: $!";
+my $fh = safer_open($new_file);
print $fh <<"EOI";
name: perl
$files
EOI
-close $fh;
+safer_close($fh);
+rename_if_different($new_file, $file);
$ make META.yml
$ git diff
-XXX it would be nice to make Porting/makemeta use regen_lib.pl
-to get the same 'update the file if its changed' functionality
-we get with 'make regen' etc.
-
Commit META.yml if it has changed:
$ git commit -m 'Update META.yml' META.yml