Update of /cvsroot/popfile/engine/Classifier
In directory sc8-pr-cvs1:/tmp/cvs-serv938/Classifier
Modified Files:
Bayes.pm
Log Message:
Add a little safety check on the color files because bonelifer had created empty color files which would cause a problem
Index: Bayes.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v
retrieving revision 1.104
retrieving revision 1.105
diff -C2 -d -r1.104 -r1.105
*** Bayes.pm 27 Feb 2003 00:40:12 -0000 1.104
--- Bayes.pm 27 Feb 2003 02:39:50 -0000 1.105
***************
*** 349,353 ****
if ( open COLOR, "<$bucket/color" ) {
$color = <COLOR>;
! $color =~ s/[\r\n]//g;
close COLOR;
}
--- 349,365 ----
if ( open COLOR, "<$bucket/color" ) {
$color = <COLOR>;
!
! # Someone (who shall remain nameless) went in an manually created
! # empty color files in their corpus directories which would cause
! # $color at this point to be undefined and hence you'd get warnings
! # about undefined variables below. So this little test is to deal
! # with that user and to make POPFile a little safer which is always
! # a good thing
!
! if ( !defined( $color ) ) {
! $color = '';
! } else {
! $color =~ s/[\r\n]//g;
! }
close COLOR;
}
|