#!/usr/bin/perl
# adapt the line above according to the location of perl on your server
#
# perl script to find all perl modules (*.pm *.pl)

my $path = $ARGV[0];
&scan_files($path);
print "\n";
exit(0);

#--------------------------------------------------------------------------
sub scan_files 
  {
  my ($scandir) = @_;
  my (@scandirs,@files,$list,$module);
  opendir(DIR,$scandir) || warn "can't open the directory $scandir: $!\n";
  @scandirs=grep {!(/^\./) && -d "$scandir/$_"} readdir(DIR);
  rewinddir(DIR);
  @files=grep (!(/^\./) && (/\.pm$|\.pl$/) && !(/\.\$\$\$$/) && -f "$scandir/$_", readdir(DIR));
  closedir (DIR);
  for $list(0..$#scandirs) 
    {
    &scan_files($scandir."/".$scandirs[$list]);
    }
  if ($#files > 0)
    {
    print "<b>$scandir</b> contains the following modules:\n";
    foreach $module(@files)
      {
      print "$module\n";
      }
    }
  return 1;
  }

