Subject: | expunge() logic problem |
Date: | Mon, 21 Apr 2008 15:08:54 +0200 |
To: | bug-Mail-IMAPClient [...] rt.cpan.org |
From: | André Warnier <aw [...] ice-sa.com> |
Hi.
In Mail::IMAPClient v 3.06, there seems to be a problem in the expunge()
routine, reproduced below.
sub expunge
{ my ($self, $folder) = @_;
my $old = $self->Folder || '';
if(defined $old && ($folder eq $old))
{ $self->_imap_command('EXPUNGE')
or return undef;
}
else
{ $self->select($folder);
my $succ = $self->_imap_command('EXPUNGE');
$self->select($old);
$succ or return undef;
}
wantarray ? $self->History : $self->Results;
}
The problem shows when calling this function like :
$imap_object->expunge();
(without folder paraneter)
Basically it outputs a warning like :
Use of uninitialized value in string eq at
C:/Perl/site/lib/Mail/IMAPClient.pm line 1762.
and it does not do the expunge() of the folder.
I made the warning disappear in my case, and the expunge() happen, by
prefixing the test as follows :
$folder = '' unless defined $folder;
if(defined $old && ($folder eq $old))
but I presume the correct solution is somewhat more delicate.
Thanks for Mail::IMAPClient anyway, works great.
Regards,
André W.