SA Bugzilla – Bug 3117
Merge CmdLearn.pm and sa-learn together
Last modified: 2004-03-01 09:58:08 UTC
So I was noticing that the only thing we have that calls CmdLearn is sa-learn, so why have CmdLearn as a module? The alternate view is: Razor does this with their code (razor-check/razor-admin/etc are all shells that call into Razor2::Client modules), and it's an absolutely crappy-ass backward design IMNSHO. Unless anyone has an issue, I'll merge it on Wednesday (3/3).
Subject: Re: New: Merge CmdLearn.pm and sa-learn together +1
+1 here too. I originally designed it that way so that sa-learn script was just a tiny call into the modules, and all the "real code" was in the Mail::SA module space; seemed likely to be cleaner. But over time, it's become clear that was wrong -- it was less "clean". In particular, the breaking of the connection between option processing and POD docs is very messy.
-1 Some of the options might need to be in sa-learn, but we still need a module to handle learning if we're going to add learning to spamd or if anyone wants to integrate learning into another application.
'Some of the options might need to be in sa-learn, but we still need a module to handle learning if we're going to add learning to spamd or if anyone wants to integrate learning into another application.' Dan, we already do with the M:SA:learn() and M:SA:PerMsgLearner apis and modules. CmdLearn is only used as the core of the command-line script, makes assumptions about ARGV, STDIN, etc. it's pure command-line stuff.
Subject: Re: Merge CmdLearn.pm and sa-learn together > Dan, we already do with the M:SA:learn() and M:SA:PerMsgLearner apis and > modules. CmdLearn is only used as the core of the command-line script, makes > assumptions about ARGV, STDIN, etc. it's pure command-line stuff. Hmmm... okay, most of it is options handling, yes, but are you sure you want to move all of the code in &wanted and the ArchiveIterator code into sa-learn? I'm not exactly sure those APIs are ones we want to expose as they're currently designed and written.
'Hmmm... okay, most of it is options handling, yes, but are you sure you want to move all of the code in &wanted and the ArchiveIterator code into sa-learn?' ArchiveIterator, no. &wanted, yes. ArchiveIterator is a shared utility class used to implement iteration over a collection of messages, and should remain in Mail::SA::ArchiveIterator. I doubt theo was thinking that.
Subject: Re: Merge CmdLearn.pm and sa-learn together > ArchiveIterator, no. &wanted, yes. No, I meant the code in CmdLearn.pm that calls ArchiveIterator. I suppose it could all be moved over... I withdraw my previous vote, although I still have a bad feeling about moving all the code into sa-learn. Moving the options makes total sense, of course. Daniel
yeah, ArchiveIterator would stay where it is ... it's used for sa-learn, mass-check, and (if I/someone else gets time) spamassassin. definitely staying seperate. but yeah, CmdLearn is just command options and a bunch of stuff that is _only_ used by sa-learn. it just doesn't make any sense to me to have sa-learn call CmdLearn when nothing else is using it. Since there are 4 +1s on this now (mine included), I'll go ahead.
ok, committed to head. r6960.