# a script to rename a file and all href links in html documents
# located in the given directory to this file
# Usage: post_process_docs.pl <directory> <file-pattern>+
# a file_pattern looks like:
# '<old-file-name>:<new-file-name>'
use strict;
use diagnostics;
@ARGV;
########
# subs #
########
sub process2 {
## Based on File::Find
# maybe a nicer solution
my $d = $_[0];
find(\&process2_file, $d);
return ();
}
sub process2_file {
# modify file
&apply_rules($_) if m/\.html$/o;
# rename file
if (m/^$old_name$/) {
rename "$old_name", "$new_name" or
die "renaming of $old_name failed \n because of: $!";
}
}
}
sub usage {
print
'Usage: post_process_docs.pl <directory> <file-pattern>+
';
exit 4;
}
sub apply_rules {
my $file_name = $_[0];
close HTML;
my $changed = 0;
}
if ($changed > 0) {
print HTML $file_contents;
print STDERR "$file_name modified\n";
close HTML;
}
}