https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6915

            Bug ID: 6915
           Summary: PerMsgStatus::get_tag() enhancement and optimization
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Libraries
          Assignee: dev@spamassassin.apache.org
          Reporter: mark.marti...@ijs.si
    Classification: Unclassified

1) The current get_tag method dynamically assembles the hash of anonymous
subroutines with every call.

This behaviour was introduced by Bug 2066 (Duncan Findlay, 2003)
in favour of a more self-contained code in _get_tag (avoiding a
global variable and avoiding passing of $pms object as a parameter),
but at the expense of dynamically constructing the hash of anonymous
subroutines with every call to get_tag, and depending on a closure
to access the $pms object.

As the number of tags has grown somewhat in the past 10 years,
and as the get_tag is called rather often, I'm suggesting essentially
a revert of Duncan's change.

My changes moves building of that hash of subs into a static BEGIN
phase as an optimization, but for this reason needs to pass an extra
argument (the $pms) to these subroutines. It only affects modules
PerMsgStatus and the Bayes plugin, public API remains unchanged.

2) Leverage the existing possibility of a tag value being an arrayref:
Introduces an additional (small) method get_tag_raw, which allows
the caller to receive the tag value as an array reference if it wishes
so, thus avoiding a need for splitting a string on a space for tags
which are actually lists, and makes it possible for a tag value
(as a list) to contain spaces without ambiguity. This will allow me
some future improvements in my AskDNS plugin.

3) A somewhat unrelated change in Message/Metadata.pm, replacing tags
LASTEXTERNALREVIP and FIRSTTRUSTEDREVIP with more universal lists:
RELAYSTRUSTEDREVIP, RELAYSUNTRUSTEDREVIP, RELAYSINTERNALREVIP,
and RELAYSEXTERNALREVIP. Neither the old nor the new tags are
currently in use by rukes, so this affects noone (except it enables
my future work on AskDNS plugin).

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

Reply via email to