}
if ($Verbose) {
- print "I will be building $_\n" foreach keys %Build;
+ print "I will be building $_\n" foreach sort keys %Build;
}
my $test = 1;
? get_pod_metadata(0, sub {
printf "1..%d\n", 1 + scalar keys %Build;
if (@_) {
- print "not ok $test\n";
+ print "not ok $test # got Pod metadata\n";
die @_;
}
- print "ok $test\n";
+ print "ok $test # got Pod metadata\n";
})
: get_pod_metadata(1, sub { warn @_ if @_ }, values %Build);
$line;
}
-sub verify_contiguous {
- my ($name, $content, $re, $what) = @_;
- require Carp;
- $content =~ s/$re/\0/g;
- my $sections = () = $content =~ m/\0+/g;
- Carp::croak("$0: $name contains no $what") if $sections < 1;
- Carp::croak("$0: $name contains discontiguous $what") if $sections > 1;
- return $content;
-}
-
sub do_manifest {
my ($name, $prev) = @_;
my @manifest =
}
# Do stuff
-while (my ($target, $name) = each %Build) {
- print "Now processing $name\n" if $Verbose;
-
- my $orig = slurp_or_die($name);
- my_die "$name contains NUL bytes" if $orig =~ /\0/;
-
- my $new = do {
- no strict 'refs';
- &{"do_$target"}($target, $orig);
- };
-
- if ($Test) {
- printf "%s %d # $name is up to date\n",
- $new eq $orig ? 'ok' : 'not ok',
- ++$test;
- next;
- } elsif ($new eq $orig) {
- print "Was not modified\n"
- if $Verbose;
- next;
- }
-
- my $mode = (stat $name)[2] // my_die "Can't stat $name: $!";
- rename $name, "$name.old" or my_die "Can't rename $name to $name.old: $!";
-
- write_or_die($name, $new);
- chmod $mode & 0777, $name or my_die "can't chmod $mode $name: $!";
-}
+process($_, $Build{$_}, main->can("do_$_"), $Test && ++$test, $Verbose)
+ foreach sort keys %Build;
# Local variables:
# cperl-indent-level: 4