#!/usr/bin/perl use strict; use vars qw { @spam @ham $USER }; $USER = shift; if ($USER eq "") { $USER = "global"; } opendir(DIR, "./ham"); @ham = grep(!/^\.\.?$/, readdir(DIR)); closedir(DIR); opendir(DIR, "./spam"); @spam = grep(!/^\.\.?$/, readdir(DIR)); closedir(DIR); print "$#ham ham entries\n"; print "$#spam spam entries\n"; print "Training user '$USER'...\n"; while($#ham>=0) { my($file) = shift(@ham); print "training $file as HAM...\n"; system("dspam --user $USER --corpus --inoculate < ./ham/$file"); } while($#spam>=0) { my($file) = shift(@spam); print "training $file as SPAM...\n"; system("dspam --user $USER --corpus --addspam --inoculate < ./spam/$file"); } #print "\nFinished. Running dspam_clean -p0 $USER...\n"; #system("dspam_clean -p0 $USER"); print "\nFinished.\n";