6 use vars qw($bot_base_dir $bot_src_dir $bot_misc_dir $bot_state_dir
7 $bot_data_dir $bot_config_dir $bot_log_dir $bot_run_dir
8 $bot_pid $memusage %param
13 if ( !scalar @ARGV ) {
14 print "Usage: $0 <pack1.fact> [<pack2.fact> <pack2.fact> ...]\n";
15 print "Example: $0 areacodes.fact usazips.fact\n";
20 # set any $bot_*_dir var's
22 $bot_config_dir = 'files/';
23 $bot_data_dir = 'files/';
24 $bot_state_dir = 'files/';
26 $bot_src_dir = "$bot_base_dir/src";
27 $bot_log_dir = "$bot_base_dir/log";
28 $bot_misc_dir = "$bot_base_dir/files";
31 require "$bot_src_dir/logger.pl";
32 require "$bot_src_dir/core.pl";
33 require "$bot_src_dir/modules.pl";
35 # Initialize enough to get DB access
39 &loadFactoidsModules();
42 if ( !scalar @ARGV ) {
43 print "Usage: $0 <pack1.fact> [<pack2.fact> <pack2.fact> ...]\n";
44 print "Example: $0 areacodes.fact usazips.fact\n";
49 next unless ( -f $_ );
52 open( IN, $file ) or die "error: cannot open $file\n";
53 print "Opened $file for input...\n";
55 print "inserting... ";
61 # Split into "key => value" pairs
62 my ($key, $value) = split(/=>/,$_,2);
64 # Strip extra begin/end whitespace
65 $key =~ s/^\s*(.*?)\s*$/$1/;
66 $value =~ s/^\s*(.*?)\s*$/$1/;
72 # The key needs to be lower case to match query case
75 ### TODO: check if it already exists. if so, don't add.
76 ### TODO: combine 2 setFactInfo's into single
77 &setFactInfo( $key, "factoid_value", $value );
78 &setFactInfo( $key, "created_by", $file );
86 # vim:ts=4:sw=4:expandtab:tw=80