version 1.6, 2000/10/22 01:25:25
|
version 1.7, 2000/11/11 00:35:39
|
Line 6 updateindex.pl - a script for creation o
|
Line 6 updateindex.pl - a script for creation o
|
|
|
=head1 SYNOPSIS |
=head1 SYNOPSIS |
|
|
updateind.pl [B<-i> I<indexfile>] [B<-y>|B<-n>] |
updateind.pl [B<-i> I<indexfile>] [B<-y>|B<-n>] [B<-r>] |
|
|
|
|
=head1 DESCRIPTION |
=head1 DESCRIPTION |
Line 42 Answer 'yes' to all questions
|
Line 42 Answer 'yes' to all questions
|
|
|
Answer 'no' to all questions |
Answer 'no' to all questions |
|
|
|
=item B<-r> |
|
|
|
Remove all entries with zero QuestionNum |
|
|
=head1 BUGS |
=head1 BUGS |
|
|
The database, user and password are hardcoded. |
The database, user and password are hardcoded. |
Line 59 Boris Veytsman
|
Line 63 Boris Veytsman
|
=cut |
=cut |
|
|
use strict; |
use strict; |
use vars qw($opt_i $opt_h $opt_y $opt_n); |
use vars qw($opt_i $opt_h $opt_y $opt_n $opt_r); |
|
|
use Getopt::Std; |
use Getopt::Std; |
use DBI; |
use DBI; |
|
|
MAIN: |
MAIN: |
{ |
{ |
my $USAGE="Usage: updateindex.pl [-i indexfile] [-y|-n]\n"; |
my $USAGE="Usage: updateindex.pl [-i indexfile] [-y|-n][-r]\n"; |
getopts('hi:yn') or die $USAGE; |
my $REMOVE=0; |
|
getopts('hi:ynr') or die $USAGE; |
if ($opt_h) { |
if ($opt_h) { |
print $USAGE; |
print $USAGE; |
exit 0; |
exit 0; |
Line 79 MAIN:
|
Line 84 MAIN:
|
if ($opt_n ) { |
if ($opt_n ) { |
$decision = 'no'; |
$decision = 'no'; |
} |
} |
|
if ($opt_r) { |
|
$REMOVE=1; |
|
} |
my($source) = $opt_i; |
my($source) = $opt_i; |
my($depth, @depthId); |
my($depth, @depthId); |
my $filename; |
my $filename; |
Line 119 MAIN:
|
Line 127 MAIN:
|
} |
} |
print STDERR "Всего вопросов: ", |
print STDERR "Всего вопросов: ", |
UpdateGroup($dbh,0),"\n"; |
UpdateGroup($dbh,0),"\n"; |
|
if ($REMOVE) { |
|
print STDERR "Removing empty tours."; |
|
$dbh->do("DELETE FROM Tournaments WHERE QuestionsNum=0"); |
|
} |
$dbh->disconnect; |
$dbh->disconnect; |
} |
} |
|
|