From: <jgr...@us...> - 2003-02-19 19:50:00
|
Update of /cvsroot/popfile/engine/Classifier In directory sc8-pr-cvs1:/tmp/cvs-serv17026/Classifier Modified Files: Bayes.pm Log Message: When writing the history file used \n instead of $eol so that the appropriate platform EOL gets placed in the file Index: Bayes.pm =================================================================== RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** Bayes.pm 19 Feb 2003 19:43:14 -0000 1.97 --- Bayes.pm 19 Feb 2003 19:49:41 -0000 1.98 *************** *** 753,763 **** open TEMP, ">$temp_file"; - binmode TEMP; while ( <$mail> ) { my $line; $line = $_; # Check for an abort --- 753,771 ---- open TEMP, ">$temp_file"; while ( <$mail> ) { my $line; + my $fileline; $line = $_; + # This is done so that we remove the network style end of line CR LF + # and allow Perl to decide on the local system EOL which it will expand + # out of \n when this gets written to the temp file + + $fileline = $line; + $fileline =~ s/[\r\n]//g; + $fileline .= "\n"; + # Check for an abort *************** *** 775,779 **** if ( !( $line =~ /^(\r\n|\r|\n)$/i ) ) { $message_size += length $line; ! print TEMP $line; if ( $line =~ /^Subject:(.*)/i ) { --- 783,787 ---- if ( !( $line =~ /^(\r\n|\r|\n)$/i ) ) { $message_size += length $line; ! print TEMP $fileline; if ( $line =~ /^Subject:(.*)/i ) { *************** *** 792,796 **** } } else { ! print TEMP $eol; $message_size += length $eol; $getting_headers = 0; --- 800,804 ---- } } else { ! print TEMP "\n"; $message_size += length $eol; $getting_headers = 0; *************** *** 798,803 **** } else { $message_size += length $line; ! print TEMP $line; ! $msg_body .= $line; } --- 806,811 ---- } else { $message_size += length $line; ! $msg_body .= $line; ! print TEMP $fileline; } |