Mail::...Parser(3pm)
π Mail::SpamAssassin::Conf::Parser β parse SpamAssassin configuration π
okay bestie so this is the Mail::...Parser(3pm) page, from the User Contributed Perl Documentation corner of the internet, and it's literally the β¨config-parsingβ¨ moment of SpamAssassin. let's get into it π«Ά
πΈ NAME πΈ
Mail::SpamAssassin::Conf::Parser β parse SpamAssassin configuration. that's it, that's the job, she does one thing and she ATE π
β¨ SYNOPSIS β¨
(see Mail::SpamAssassin)
like, go read the other page, this one's shy π
π¦ DESCRIPTION π¦
Mail::SpamAssassin is a module to identify spam using text analysis and several internet-based realtime blocklists. iconic behavior, no cap.
This class is used internally by SpamAssassin to parse its configuration files. so like, she's backstage crew, not main character β pls refer to the Mail::SpamAssassin documentation for public interfaces. iykyk π
π STRUCTURE OF A CONFIG BLOCK π
here's the tea: this is the structure of a config-setting block. each one is a hashref which may contain these keys π
settingβ the name of the setting it modifies, e.g."required_score". this also doubles as the default for 'command' (below). THIS IS REQUIRED. like, non-negotiable bestie π¨commandβ The command string used in the config file for this setting. Optional; 'setting' will be used for the command if this is omitted. lowkey a fallback queen πaliasesβ An [aryref] of other aliases for the same command. optional.typeβ The type of this setting:$CONF_TYPE_NOARGS: must not have any argument, like"clear_headers"$CONF_TYPE_STRING: string$CONF_TYPE_NUMERIC: numeric value (float or int)$CONF_TYPE_BOOL: boolean (0/no or 1/yes)$CONF_TYPE_TEMPLATE: template, like"report"$CONF_TYPE_ADDRLIST: list of mail addresses, like"welcomelist_from"$CONF_TYPE_HASH_KEY_VALUE: hash key/value pair, like"describe"or tflags$CONF_TYPE_STRINGLISTlist of strings, stored as an array$CONF_TYPE_IPADDRLISTlist of IP addresses, stored as an array of SA::NetSet$CONF_TYPE_DURATIONa nonnegative time interval in seconds - a numeric value (float or int), optionally suffixed by a time unit (s, m, h, d, w), seconds are implied if unit is missing
If this is set, and a 'code' block does not already exist, a 'code' block is assigned based on the type. automatic, effortless, slay β¨
In addition, the SpamAssassin test suite will validate that the settings do not 'leak' between users.
Note that $CONF_TYPE_HASH_KEY_VALUE-type settings require that the value be non-empty, otherwise they'll produce a warning message. empty value = she will simply speak up about it π
codeβ A subroutine to deal with the setting. ONE OF code OR type IS REQUIRED. The arguments passed to the function are($self, $key, $value, $line)β where$keyis the setting (not the command),$valueis the value string, and$lineis the entire line.
There are two special return values that the code subroutine may return to signal that there is an error in the configuration:
$Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUEβ this setting requires that a value be set, but one was not provided. π$Mail::SpamAssassin::Conf::INVALID_VALUEβ this setting requires a value from a set of 'valid' values, but the user provided an invalid one. π$Mail::SpamAssassin::Conf::INVALID_HEADER_FIELD_NAMEβ this setting requires a syntactically valid header field name, but the user provided an invalid one.
Any other values β including "undef" β returned from the subroutine are considered to mean 'success' π
It is good practice to set a 'type', if possible, describing how your settings are stored on the Conf object; this allows the SpamAssassin test suite to validate that the settings do not 'leak' between users. do it for the plot π«Ά
defaultβ The default value for the setting. may be omitted if the default value is a non-scalar type, which should be set in the Conf ctor. note for path types: using"__userstate__"is recommended for defaults, as it allows Mail::SpamAssassin module users who set that configuration setting, to receive the correct values. thoughtful queen πΈis_privβ Set to 1 if this setting requires'allow_user_rules'when run from spamd. πis_adminβ Set to 1 if this setting can only be set in the system-wide config when run from spamd. (All settings can be used by local programs run directly by the user.) π
and that's the whole page bestie, you're so caught up now π β¨
signing off cutely: this was page Mail::...Parser(3pm), from perl v5.40.1, dated 2026-07-23 β perl v5.40.1 Β· 2026-07-23 Β· Mail::...Parser(3pm). go parse some config, you've got this ππ¦π
π¦ where this page comes from
- ubuntu stonking: spamassassin 4.0.2+svn1935691-1build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms