Update of /cvsroot/popfile/engine/Services
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32445/Services
Modified Files:
Tag: b0_22_2
IMAP.pm
Log Message:
Implement some best-practice advice:
use modern open
don't rebless the module
Index: IMAP.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Services/IMAP.pm,v
retrieving revision 1.9.4.15
retrieving revision 1.9.4.16
diff -C2 -d -r1.9.4.15 -r1.9.4.16
*** IMAP.pm 30 Nov 2007 21:13:40 -0000 1.9.4.15
--- IMAP.pm 1 Dec 2007 11:19:06 -0000 1.9.4.16
***************
*** 55,61 ****
sub new {
my $type = shift;
! my $self = POPFile::Module->new();
!
! bless $self, $type;
$self->name( 'imap' );
--- 55,59 ----
sub new {
my $type = shift;
! my $self = $type->SUPER::new();
$self->name( 'imap' );
***************
*** 875,896 ****
my $file = $self->get_user_path_( 'imap.tmp' );
! unless ( open TMP, ">$file" ) {
! $self->log_( 0, "Cannot open temp file $file" );
! return;
! };
!
! foreach ( @lines ) {
! print TMP $_;
! }
! close TMP;
! my $slot = $self->history()->get_slot_from_hash( $hash );
! $self->classifier()->add_message_to_bucket( $self->api_session(), $new_bucket, $file );
! $self->classifier()->reclassified( $self->api_session(), $old_bucket, $new_bucket, 0 );
! $self->history()->change_slot_classification( $slot, $new_bucket, $self->api_session(), 0);
! $self->log_( 0, "Reclassified the message with UID $msg from bucket $old_bucket to bucket $new_bucket." );
! unlink $file;
}
--- 873,895 ----
my $file = $self->get_user_path_( 'imap.tmp' );
! if ( open my $TMP, '>', $file ) {
! foreach ( @lines ) {
! print $TMP $_;
! }
! close $TMP;
! my $slot = $self->history()->get_slot_from_hash( $hash );
! $self->classifier()->add_message_to_bucket( $self->api_session(), $new_bucket, $file );
! $self->classifier()->reclassified( $self->api_session(), $old_bucket, $new_bucket, 0 );
! $self->history()->change_slot_classification( $slot, $new_bucket, $self->api_session(), 0);
! $self->log_( 0, "Reclassified the message with UID $msg from bucket $old_bucket to bucket $new_bucket." );
! unlink $file;
! }
! else {
! $self->log_( 0, "Cannot open temp file $file" );
! return;
! }
}
|