You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2004/07/30 07:40:54 UTC
[Bug 3650] New: [patch] Can't call SpamAssassin->finish(), multiple finish() errors
http://bugzilla.spamassassin.org/show_bug.cgi?id=3650
Summary: [patch] Can't call SpamAssassin->finish(), multiple
finish() errors
Product: Spamassassin
Version: SVN Trunk (Latest Devel Version)
Platform: All
OS/Version: FreeBSD
Status: NEW
Severity: major
Priority: P5
Component: Libraries
AssignedTo: spamassassin-dev@incubator.apache.org
ReportedBy: ryan@sasknow.com
This example fails on -pre3:
use Mail::SpamAssassin;
my $spamtest = Mail::SpamAssassin->new( ) or
die "Can't create SpamAssassin object";
$spamtest->finish();
Minimal enough? :-)
The above code produces the following error:
Can't locate object method "finish" via package
"Mail::SpamAssassin::Conf::Parser" at
/usr/local/lib/perl5/site_perl/5.8.4/Mail/SpamAssassin/Conf.pm line 3472.
Conf.pm:3472 $self->{parser}->finish();
As stated in the error, Conf::Parser.pm has no finish() method.
Suggested fix:
--- Conf.pm.orig Thu Jul 29 22:26:05 2004
+++ Conf.pm Thu Jul 29 22:26:26 2004
@@ -3469,7 +3469,6 @@
sub finish {
my ($self) = @_;
- $self->{parser}->finish();
delete $self->{parser};
delete $self->{main};
}
After clearing that up, I then see:
Can't locate object method "finish" via package
"Mail::SpamAssassin::Plugin::URIDNSBL" at
/usr/local/lib/perl5/site_perl/5.8.4/Mail/SpamAssassin/PluginHandler.pm line 157.
OK.. let's see how deep the rabbit hole goes.. :-)
*None* of the plugins I looked at had finish() methods defined, and we probably
don't want to crash if 3rd party plugins don't play nicely, either, so I'd suggest:
--- SpamAssassin.orig/PluginHandler.pm Wed Apr 28 01:55:04 2004
+++ SpamAssassin/PluginHandler.pm Thu Jul 29 23:14:28 2004
@@ -154,7 +154,7 @@
my $self = shift;
delete $self->{cbs};
foreach my $plugin (@{$self->{plugins}}) {
- $plugin->finish();
+ eval('$plugin->finish()'); # finish() may not be defined
delete $plugin->{main};
}
delete $self->{plugins};
Not satisfied with those two, I then did a manual trace through the finish()
code in SpamAssassin.pm, and followed it all the way down the call stack. I'm
now quite certain there aren't any other finish() calls that will kick our
butts. :-)
Calling finish() now works for me as documented in Mail::SpamAssassin.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.