#!/usr/bin/perl -w
#
# load.pl 
# 
# J. Uckelman (uckelman@iastate.edu)
# 30 September 2000
#

require 5.005;
use DBI;

my $version = 0.1;
my $config = '/home/g1/bin/scripts.conf';

eval { require $config; } ; die "$0: $config: $@\n" if $@;

my $dbh = DBI->connect($dsn, $user, $password);

open FILE, "/home/g1/rules.new";
my $data = join '', <FILE>;
close FILE;

$i = 0;
while (($title, $text) = $data =~ m/(.*?)\n--\n{2}(.*?)\n{2}--\n/s) {
	$data = $';
	$i++;
	$title = quotemeta($title);
	$text = quotemeta($text);	
	$dbh->do("insert into rule (number, title, text) values ($i, '$title', '$text')");
}

$dbh->disconnect;
