Subject: | Bugs in Mail::IMAPClient |
Date: | Sun, 13 Apr 2008 16:50:37 -0700 |
To: | bug-Mail-IMAPClient [...] rt.cpan.org |
From: | "j w" <jwdevel [...] gmail.com> |
Hello,
I'm playing around with Mail::IMAPClient, and there's a couple issues that
came up:
(1) The expunge method seems buggy. There is one 'ne' that I think should be
'eq'
Here is a patch against v3.05:
diff --git a/site/lib/Mail/IMAPClient.pm b/site/lib/Mail/IMAPClient.pm
--- a/site/lib/Mail/IMAPClient.pm
+++ b/site/lib/Mail/IMAPClient.pm
@@ -1761,7 +1761,7 @@
or return;
my $old = $self->Folder;
- if(defined $old && $folder eq $old)
+ if(defined $old && $folder ne $old)
{ $self->select($folder);
my $succ = $self->_imap_command('EXPUNGE');
$self->select($old);
As it is now, passing the name of a mailbox to the function will likely
cause it to expunge the wrong mailbox.
(2) Calling expunge with no arguments returns undef, rather than expunging
the currently selected mailbox, as the docs indicate.
This seems like it must be by design, since there is the following code at
the beginning of expunge:
sub expunge
{ my ($self, $folder) = @_;
defined $folder
or return;
So if no $folder is passed in, it returns undef. It's just not what the docs
indicate.
(3) I can't seem to get the "default method" to work. I tried to use
$imap->EXPUNGE as a workaround to the above issues, but it didn't work.
I tried the example in the documentation, and it doesn't seem to work
either:
Try this script:
use Mail::IMAPClient;
my $imap = Mail::IMAPClient->new(
User => 'joeblo',
Password => 'blabla',
Debug => 1,
);
my @results = $imap->FOO("bar","an example","of the default");
That gives me the error: Can't locate object method "FOO" via package
"Mail::IMAPClient" at ...
I would expect it to error (since it's not connected), but it says it can't
even find the method to run. Or perhaps I misunderstand how the default
method functionality works?
My setup:
Perl v5.8.7 built for MSWin32-x86-multi-thread
Windows XP
Let me know if you need other info
-John