Update of /cvsroot/popfile/engine/Classifier
In directory sc8-pr-cvs1:/tmp/cvs-serv1781
Modified Files:
Bayes.pm
Log Message:
move file unlinking to unlink after new caching code when nosave is 1
add ability to retrieve file-names for dcount, mcount without appended path
retrieve path-less filename for class-files (class-file API handles paths)
Index: Bayes.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Classifier/Bayes.pm,v
retrieving revision 1.159
retrieving revision 1.160
diff -C2 -d -r1.159 -r1.160
*** Bayes.pm 4 Jul 2003 03:55:00 -0000 1.159
--- Bayes.pm 6 Jul 2003 07:49:19 -0000 1.160
***************
*** 834,844 ****
# $mcount - the message count for this message
# $ext - the extension for this message (defaults to .msg)
#
# ---------------------------------------------------------------------------------------------
sub history_filename
{
! my ( $self, $dcount, $mcount, $ext) = @_;
! return $self->global_config_( 'msgdir' ) . "popfile$dcount" . "=$mcount" . (defined $ext?$ext:'.msg');
}
--- 834,847 ----
# $mcount - the message count for this message
# $ext - the extension for this message (defaults to .msg)
+ # $path - 1 to return the path configuration info, 0 to return just the filename (default 0)
#
# ---------------------------------------------------------------------------------------------
sub history_filename
{
! my ( $self, $dcount, $mcount, $ext, $path) = @_;
!
! $path = 0 if (!defined($path));
! return ($path?$self->global_config_( 'msgdir' ):'') . "popfile$dcount" . "=$mcount" . (defined $ext?$ext:'.msg');
}
***************
*** 979,984 ****
my $getting_headers = 1;
! my $temp_file = $self->history_filename($dcount,$mcount, ".msg");
! my $class_file = $self->history_filename($dcount,$mcount, ".cls");
open TEMP, ">$temp_file";
--- 982,989 ----
my $getting_headers = 1;
! my $temp_file = $self->history_filename($dcount,$mcount, ".msg",1);
!
! # Get the class-file info without the path, since we'd just need to strip it
! my $class_file = $self->history_filename($dcount,$mcount, ".cls",0);
open TEMP, ">$temp_file";
***************
*** 1090,1097 ****
$msg_head_before .= $eol;
- if ( $nosave ) {
- unlink( $temp_file );
- }
-
# Add the XTC header
$msg_head_after .= "X-Text-Classification: $classification$eol" if ( ( $self->global_config_( 'xtc' ) ) &&
--- 1095,1098 ----
***************
*** 1173,1178 ****
}
if ( !$nosave ) {
- $class_file =~ s/^([^\/])*\///;
$self->history_write_class($class_file, undef, $classification, undef, ($self->{magnet_used__}?$self->{magnet_detail__}:undef))
}
--- 1174,1182 ----
}
+ if ( $nosave ) {
+ unlink( $temp_file );
+ }
+
if ( !$nosave ) {
$self->history_write_class($class_file, undef, $classification, undef, ($self->{magnet_used__}?$self->{magnet_detail__}:undef))
}
|