And here's a bit of Perl code that will populate the MySQL table
with our log file data by reading it in from STDIN or given on
a command line:
#!/usr/local/bin/perl
use DBI;
my $dbh=DBI->connect(qw|DBI:mysql:weblog|);
$dbh->{'RaiseError'};
my $sth=$dbh->prepare(q{INSERT INTO weblog VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)});
while (<>) {
chomp;
my @fields=split(/\t/,$_);
$sth->execute(@fields);
}
$sth->finish;
$dbh->disconnect;
__END__