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