version 1.1, 2002/07/11 20:48:31
|
version 1.2, 2003/08/05 15:51:37
|
Line 124 build_thesaurus_db.pl --badwordfile ./un
|
Line 124 build_thesaurus_db.pl --badwordfile ./un
|
## |
## |
## Get command line parameters |
## Get command line parameters |
## |
## |
my ($badwordfile,$outputdbfile,$keywordfile,$help,$test); |
my ($badwordfile,$outputdbfile,$keywordfile,$help,$checkdates,$test); |
GetOptions( "badwordfile=s" => \$badwordfile, # --badwordfile |
GetOptions( "badwordfile=s" => \$badwordfile, # --badwordfile |
"outputdb=s" => \$outputdbfile, # --outputdb |
"outputdb=s" => \$outputdbfile, # --outputdb |
"keywordfile=s" => \$keywordfile, # --keywordfile |
"keywordfile=s" => \$keywordfile, # --keywordfile |
"help" => \$help, # --help |
"help" => \$help, # --help |
|
"checkdates" => \$checkdates, # --checkdates |
"test" => \$test); # --test |
"test" => \$test); # --test |
|
|
|
|
## |
## |
## Help! Help! |
## Help! Help! |
## |
## |
Line 143 Command line arguements
|
Line 145 Command line arguements
|
put in the thesaurus. Each word must appear |
put in the thesaurus. Each word must appear |
on its own line and currently comments are not |
on its own line and currently comments are not |
supported. |
supported. |
|
--checkdates Check the creation dates on the files involved |
|
and only run if the outputdb file was created |
|
prior to one of the badword or keyword files. |
--keywordfile <filename> File containing the raw word data for the |
--keywordfile <filename> File containing the raw word data for the |
thesaurus. Each line must be comma seperated |
thesaurus. Each line must be comma seperated |
list of related keywords. |
list of related keywords. |
Line 171 foreach my $file ($badwordfile,$keywordf
|
Line 176 foreach my $file ($badwordfile,$keywordf
|
die "$file does not exist." if (! -e $file); |
die "$file does not exist." if (! -e $file); |
} |
} |
|
|
|
# |
|
# Check the dates on the input files to be sure we need to run |
|
if ($checkdates && -s $outputdbfile) { |
|
my @Results = stat($badwordfile); |
|
my $highest_dependency_ctime = $Results[10]; |
|
foreach ($keywordfile) { |
|
if ($Results[10] > $highest_dependency_ctime) { |
|
$highest_dependency_ctime = $Results[10]; |
|
} |
|
} |
|
# |
|
# if the outputdbfile was made AFTER the last version of one of the |
|
# dependencies, exit quietly. |
|
@Results = stat($outputdbfile); |
|
if ($highest_dependency_ctime < $Results[10]) { |
|
exit; |
|
} |
|
} |
|
|
## |
## |
## Global hashes. |
## Global hashes. |
## |
## |