Hi Mark,
I am having some issues with Mail::Box 2.054 and POP3 access:
# begin log snip
[Thu Mar 18 01:21:27 2004] [error] 21954: ModPerl::Registry: Can't call method
"isModified"
without a package
or object reference at /usr/local/share/perl/5.6.1/Mail/Box.pm line 435, line
116.
[Thu Mar 18 01:24:26 2004] [error] 21985: ModPerl::Registry: Can't call method
"isModified"
without a package
or object reference at /usr/local/share/perl/5.6.1/Mail/Box.pm line 435, line
116.
[Thu Mar 18 18:51:34 2004] [error] [client 10.1.1.4] Can't call method
"isModified" without a
package or
object reference at /usr/local/share/perl/5.6.1/Mail/Box.pm line 435, line 115.
[Thu Mar 18 18:57:47 2004] [error] 2751: ModPerl::Registry: Can't call method
"isModified"
without a package
or object reference at /usr/local/share/perl/5.6.1/Mail/Box.pm line 435, line
115.
[Thu Mar 18 23:07:33 2004] [error] 9159: ModPerl::Registry: Can't call method
"isDeleted"
without a package
or object reference at /usr/local/share/perl/5.6.1/Mail/Box.pm line 729, line
72.
[Thu Mar 18 23:12:39 2004] [error] 9416: ModPerl::Registry: Can't call method
"isModified"
without a package
or object reference at /usr/local/share/perl/5.6.1/Mail/Box/POP3.pm line 247,
line 72.
[Thu Mar 18 23:16:51 2004] [error] 9525: ModPerl::Registry: Can't call method
"modified"
without a package or
object reference at /usr/local/share/perl/5.6.1/Mail/Box.pm line 423, line 72.
# end log snip
I just added in a few calls to UNIVERSAL::can() before each of those calls (as
I didn't know
what ref $self
was supposed to be and I didn't have the time to trace it further) to get
around this as I was
actually looking
for a reason the following was happening:
# begin log snip
[Thu Mar 18 01:21:46 2004] POP3.pm: ERROR: Could not authenticate using any
login method
[Thu Mar 18 01:21:46 2004] -e: WARNING: Folder does not exist, failed opening
pop3 folder pop3.
# end log snip
Here is the diff of what lines I ran into to change, probably other instances I
didn't come across:
### begin patch
diff -Naur Mail-Box-2.054.orig/lib/Mail/Box/POP3.pm
Mail-Box-2.054/lib/Mail/Box/POP3.pm
--- Mail-Box-2.054.orig/lib/Mail/Box/POP3.pm Fri Feb 6 15:47:14 2004
+++ Mail-Box-2.054/lib/Mail/Box/POP3.pm Thu Mar 18 23:15:07 2004
@@ -244,7 +244,7 @@
sub writeMessages($@)
{ my ($self, $args) = @_;
- if(my $modifications = grep {$_->isModified} @{$args->{messages}})
+ if(my $modifications = grep { UNIVERSAL::can($_,"isModified") &&
$_->isModified}
@{$args->{messages}})
{ $self->log(WARNING =>
"Update of $modifications messages ignored for POP3 folder $self.");
}
diff -Naur Mail-Box-2.054.orig/lib/Mail/Box.pm Mail-Box-2.054/lib/Mail/Box.pm
--- Mail-Box-2.054.orig/lib/Mail/Box.pm Thu Mar 18 22:49:27 2004
+++ Mail-Box-2.054/lib/Mail/Box.pm Thu Mar 18 23:23:47 2004
@@ -420,7 +420,7 @@
if $self->{MB_modified} = shift; # force modified flag
# unmodify all messages
- $_->modified(0) foreach $self->messages;
+ foreach ($self->messages) { $_->modified(0) if
UNIVERSAL::can($_,"modified"); }
0;
}
@@ -433,7 +433,7 @@
foreach (@{$self->{MB_messages}})
{ return $self->{MB_modified} = 1
- if $_->isDeleted || $_->isModified;
+ if $_->isDeleted || ( UNIVERSAL::can($_,"isModified") &&
$_->isModified);
}
0;
@@ -726,7 +726,7 @@
if($args{save_deleted}) {@keep = $self->messages }
else
{ foreach ($self->messages)
- { if($_->isDeleted)
+ { if(UNIVERSAL::can($_,"isDeleted") && $_->isDeleted)
{ push @destroy, $_;
$_->diskDelete;
}
### end patch
Oddly this happens after calling closeallfolders and then trying to reopen the
pop3 connection
(in order to
commit deletes). Here is a test script that reproduces this every time.
### begin test script
#!/usr/bin/perl
$|++;
use strict;
use warnings;
use Mail::Box::Manager;
sub open_pop3 {
my $manager = shift;
return $manager->open(
type => "pop3",
username => "USER",
password => "PASS",
server_name => "HOST",
server_port => "110",
) or die "Failed to open pop3: $!";
}
my $manager = Mail::Box::Manager->new();
print "opening initial connection\n";
my $pop3 = open_pop3($manager);
# do some work...
# close all open folders, committing all deletes on the pop3 server, etc
print "closing all folders\n";
$manager->closeAllFolders();
# re-open the connection to do further work
print "opening pop3 again\n";
$pop3 = open_pop3($manager);
### end test script
which outputs:
### begin output
opening initial connection
closing all folders
opening pop3 again
ERROR: Could not authenticate using any login method
ERROR: Cannot create POP3 client for /var/mail/USER.
WARNING: Folder does not exist, failed opening pop3 folder /var/mail/USER.
### end output
Let me know if you need more info.
Take care,
jason
|