http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5543

           Summary: RFE: way to include rules and plugin code in the same
                    file
           Product: Spamassassin
           Version: 3.2.1
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: enhancement
          Priority: P5
         Component: Libraries
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


A minor annoyance with plugins is that they have to include at least
two files -- a .pm file, and a .cf file.  e.g. take the
http://wiki.apache.org/spamassassin/ClamAVPlugin --

clamav.cf:

    loadplugin ClamAV clamav.pm
    full CLAMAV eval:check_clamav()
    describe CLAMAV Clam AntiVirus detected a virus
    score CLAMAV 10

clamav.pm:

    package ClamAV;
    use strict;
    use Mail::SpamAssassin;
    use Mail::SpamAssassin::Plugin;
    use File::Scan::ClamAV;
    our @ISA = qw(Mail::SpamAssassin::Plugin);

    sub new {
      my ($class, $mailsa) = @_;
      $class = ref($class) || $class;
      ...etc.
    }
    ...etc.
    1;


It'd be great if we could come up with a way to consolidate this
into one.  That'd be a lot easier to distribute, I think.

How's about this: if a ".pm" file is found, and it contains
a scalar called $PackageName::SPAMASSASSIN_CONFIG, we load that
as SpamAssassin configuration, as if it was a ".cf" file.
e.g.

    package ClamAV;
    our $SPAMASSASSIN_CONFIG = q{

      loadplugin ClamAV clamav.pm
      full CLAMAV eval:check_clamav()
      describe CLAMAV Clam AntiVirus detected a virus
      score CLAMAV 10

    };

    use strict;
    use Mail::SpamAssassin;
    use Mail::SpamAssassin::Plugin;
    use File::Scan::ClamAV;
    our @ISA = qw(Mail::SpamAssassin::Plugin);
    ...etc.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Reply via email to