# Variables
$output = "/home/web/path/to/foo/foo.htm";
$jscriptdir = "/home/web/foo/javascript/";
$javadir = "/home/web/foo/servlet/";
$cgidir = "/home/web/cgi-bin/";
# Open the output file
open(NEW,">$output") or die "Can't Open $output: $!";
print NEW "
Comment Extractor\n";
print NEW "\n";
print NEW "Comment Extractor
\n";
print NEW "
\n";
# Let's find files. Call jsfind for the dirty work
find (\&jsfind, $jscriptdir);
print NEW "\n";
close NEW;
exit;
sub jsfind {
# get all file names that have last 2 characters "js"
if($File::Find::name=~/\.js$/)
{
# ignore js files in those stupid Frontpage _vti* directories
if ($File::Find::name=~/\_vti/) {} else
{
# get name of script file and print it in red
$script_title = $_;
print NEW "" . $script_title . "";
# placeholder for file
# start opening files to read
open(FILE, $File::Find::name) or die "could not open file - $_ - : $!";
# iterate thru files to find match //**
while ()
{
if ($_ =~ /\*\*/) {
# print files to $output
print NEW substr($_,4) . "
";
}
}
close FILE;
}
} else {
return;
}
}