/home/uherbst/Daten/Projekte/ServDoc/servdoc/install.cvs.pl
#!/usr/bin/perl -w
# Put a relative symlink to [servdoc-root]/lib/ServDoc.pm in all
# .../lib directories.
use File::Find;
File::Find::find(
{
wanted => sub {
my $bigpath = $File::Find::name;
my $name = $_;
if ( $name !~ /lib$/ ) { return }
; # This is not a .../lib directory
if ( !-d $name ) { return; } # This is not a directory
if ( !-l "$name/ServDoc.pm" and -e _ ) { return; }
# Here is a real "ServDoc.pm" !
unlink "$name/ServDoc.pm"; # delete the old link.
my $nr_subdirs = 0; # How many directory levels
# below [servdoc-root] ?
my $pos = -1;
while ( ( $pos = index( $bigpath, "/", $pos ) ) > -1 ) {
$nr_subdirs++;
$pos++;
}
symlink "../" x $nr_subdirs . "lib/ServDoc.pm", "$name/ServDoc.pm";
}
},
"."
)