Calculation of current_age with missing Client-Date.
[libwww-perl-eserte.git] / bin / pod-after-end
blobf4288e56606053ee1fa2c2d5a291d1af172d5899
1 #!/usr/bin/perl -w
3 use strict;
5 for my $mod (@ARGV) {
6 open(my $old, "<$mod") || do {
7 warn "Failed to open $mod: $!\n";
8 next;
9 };
11 open(my $new, ">$mod.new") || do {
12 warn "Failed to create $mod.new: $!";
13 next;
16 my @pod;
18 while (<$old>) {
19 if (/^=\w/ .. /^=cut/) {
20 push(@pod, $_) unless /^=cut/;
22 else {
23 print $new $_;
27 if (@pod) {
28 print $new "\n__END__\n\n";
29 print $new @pod;
31 close($new) || die;
33 rename($mod, "$mod.orig") || warn "Can't rename $mod: $!";
34 rename("$mod.new", $mod) || warn "Can't rename $mod.new: $!";
36 else {
37 print "No pod found in $mod\n";
38 close($new);
39 unlink("$mod.new");