version 1.1, 2003/03/17 15:06:03
|
version 1.4, 2003/03/17 15:49:27
|
Line 26 Boris Veytsman
|
Line 26 Boris Veytsman
|
=head1 $Id$ |
=head1 $Id$ |
|
|
=cut |
=cut |
|
|
|
use strict; |
|
use DBI; |
|
|
|
|
|
# Creating hash dbtochronicles; |
|
my($dbh) = DBI->connect("DBI:mysql:chgk", "piataev", "") |
|
or die "Can't connect to DB chgk\n"; |
|
my %dbtochronicles; |
|
my $sth=$dbh->prepare("SELECT FileName,URL from Tournaments where Type='þ' |
|
and not isnull(URL)"); |
|
$sth->execute; |
|
while (my ($name,$url) = $sth->fetchrow_array) { |
|
$dbtochronicles{$name}=$url; |
|
} |
|
|
|
|
|
# Checking chronicles |
|
if (! -d $ARGV[0]) { |
|
die "Cannot read $ARGV[0]"; |
|
} |
|
chdir $ARGV[0] || die "Cannot chdir to $ARGV[0]: $!"; |
|
opendir (DIR, ".") || die "Cannot open $ARGV[0]: $!"; |
|
while (my $file=readdir(DIR)) { |
|
if (-f $file && $file =~ /html$/) { |
|
open (FILE, $file); |
|
while (<FILE>) { |
|
chomp; |
|
if (/znatoki\/cgi-bin\/db.cgi\?tour=([^\"]*)\"/) { |
|
my $name="$1.txt"; |
|
if (!exists($dbtochronicles{$name}) || |
|
$dbtochronicles{$name} !~ /$file$/) { |
|
print "$file -> $name\n"; |
|
} else { |
|
delete($dbtochronicles{$name}); |
|
} |
|
} |
|
} |
|
close FILE; |
|
} |
|
} |
|
closedir DIR; |
|
foreach my $name (keys %dbtochronicles) { |
|
if ($dbtochronicles{$name} =~ /boris/) { |
|
print "$name -> $dbtochronicles{$name}\n"; |
|
} |
|
} |
|
|
|
exit 0; |
|
|