Sympa::Spool(3Sympa)
π Sympa::Spool β the base class of all the spool classes π
okay bestie, welcome to Sympa::Spool(3Sympa) from sympa 6.2.80 β this is the mothership, the blueprint, the main character that every single spool subclass in Sympa inherits from. Let's get into it π«Ά
β¨ SYNOPSIS β¨
like, here's the vibe of a subclass. you write it exactly like this:
package Sympa::Spool::FOO;
use base qw(Sympa::Spool);
sub _directories {
return {
directory => '/path/to/spool',
bad_directory => '/path/to/spool/bad',
};
}
use constant _generator => 'Sympa::Message';
use constant _marshal_format => '%s@%s.%ld.%ld,%d';
use constant _marshal_keys => [qw(localpart domainpart date PID RAND)];
use constant _marshal_regexp =>
qr{\A([^\s\@]+)(?:\@([\w\.\-]+))?\.(\d+)\.(\w+)(?:,.*)?\z};
1;
no cap, that's the whole skeleton. slay. π
πΈ DESCRIPTION πΈ
This module is the base class for spool subclasses of Sympa. Translation: it's the parent, and all the little spool classes are its children. iconic family tree honestly π
π Public methods
new ( [ options... ] )β Constructor. Creates new instance of the class. that's it, that's the whole job.marshal ( $message, [ keep_keys => 1 ] )β Instance method. Gets marshalled key (file name) of the message.
Parameters:
$messageβ Message to be marshalled.keep_keys => 1β Seemarshal_metadata().
next ( [ no_filter => 1 ], [ no_lock => 1 ] )β Instance method. Gets next message to process, order is controlled by name of spool file and so on. Message will be locked to prevent multiple processing of a single message. (yes bestie, it's locking so two processes don't grab the same thing and cause chaos π)
Parameters:
no_filter => 1β Won't skip messages when filter defined by_filter()returns false.no_lock => 1β Won't lock messages.
Returns:
Two-elements list of message instance and filehandle locking a message. If parsing message fails, list of undef and filehandle. If no more message found, empty array.
If no_lock is set, true scalar value will be returned in place of filehandle.
quarantine ( $handle )β Instance method. Quarantines a message. On filesystem spool, message will be moved into{bad_directory}of the spool usingrename(). it's giving time-out corner for bad messages π
Parameter:
$handleβ Filehandle, Sympa::LockedFile instance, locking message.
Returns:
True value if message could be quarantined. Otherwise false value.
If $handle was not a filehandle, this method will die. (fr fr, it dies. no chill.)
remove ( $handle )β Instance method. Removes a message. bye bye π
Parameter:
$handleβ Filehandle, Sympa::LockedFile instance, locking message.
Returns:
True value if message could be removed. Otherwise false value.
If $handle was not a filehandle, this method will die. same energy as above.
size ( )β Instance method. Gets the number of messages the spool contains.
Parameters:
None. literally nothing.
Returns:
Number of messages.
Note: This method returns the number of messages_load()returns, not applying_filter(). so like, it's the raw count, not the filtered count. iykyk.
store ( $message, [ original => $original ] )β Instance method. Stores the message into spool.
Parameters:
$messageβ Message to be stored.original => $originalβ If true value is specified and $message was decrypted, Stores original encrypted form. π
Returns:
If storing succeeded, marshalled metadata (file name) of the message. Otherwise undef.
unmarshal ( $marshalled )β Instance method. Gets metadata from marshalled key (file name).
Parameters:
$marshalledβ Marshalled key.
Returns:
Hashref containing metadata.
π Properties
Instance of Sympa::Spool may have following properties.
- Directories β Directories
_directories()method returns:{directory},{bad_directory}and so on.
π¦ Low level functions
build_glob_pattern ( $marshal_format, $marshal_keys, [ key => value, ... ] )β Function. Builds a glob pattern from parameters and returns it. If built pattern is empty or contains only punctuations, i.e.[^0-9A-Za-z\x80-\xFF], will returnundef.split_listname ( $robot, $localpart )β Function. Split local part of e-mail to list name and type. Returns an array(name, type). Note that the list with returned name may or may not exist. (so don't get too excited, it's just string surgery ok π )
If local part looks like listmaster or sympa address, name is undef and type is either 'listmaster' or 'sympa'. Otherwise, type is either 'editor', 'owner', 'return_path', 'subscribe', 'unsubscribe', 'UNKNOWN' or undef.
Note: For-requestand-ownersuffix, this function returnsownerandreturn_pathtypes, respectively. yeah it's tricky like that, don't @ me.
store_spool ( $spool_dir, $message, $marshal_format, $marshal_keys, [ key => value, ... ] )β Function. Store $message into directory $spool_dir as a file with name as marshalled metadata using $marshal_format and $marshal_keys.unmarshal_metadata ( $spool_dir, $marshalled, $marshal_regexp, $marshal_keys )β Function. Unmarshals metadata. Returns hashref with keys in arrayref $marshal_keys and values with substrings captured by regexp $marshal_regexp. If $marshalled did not match against $marshal_regexp, returnsundef.
The keys localpart and domainpart are special. Following keys are derived from them: context, listname, listtype, priority. β¨
marshal_metadata ( $message, $marshal_format, $marshal_keys, [ keep_keys => 1 ] )β Function. Marshals metadata. Returns formatted string bysprintf()using $marshal_format and metadatas indexed by keys in arrayref $marshal_keys.
If key is uppercase, it means auto-generated value: 'AUTHKEY', 'KEYAUTH', 'PID', 'RAND', 'TIME'. Otherwise it means metadata or property of $message. If keep_keys option (added on 6.2.23b) is set, forces using latter. ποΈ
sprintf() is executed under C locale: Full stop (.) is always used for decimal point in floating point number. okay so no comma decimals, ever, periodt.
π Methods subclass should implement
_create ( )β Instance method, overridable. Creates spool. By default, creates directories returned by_directories()._directories ( [ options, ... ] )β Class or instance method, mandatory for filesystem spool. Returns hashref with directory paths related to the spool as values. It must have keys at leastdirectoryand (if you wish to implementquarantine()method)bad_directory._filter ( $metadata )β Instance method, overridable. If it returned false value, processing of $metadata bynext()will be skipped. By default, always returns true value.
This method may modify unmarshalled metadata and deserialized messages include it. (sneaky but allowed β¨)
_filter_pre ( $metadata )β Instance method, overridable. If it returned false value, processing of $metadata bystore()will be skipped. By default, always returns true value.
This method may modify marshalled metadata but stored messages are not affected.
_generator ( )β Class or instance method, mandatory. Returns name of the class to serialize and deserialize messages in the spool. If spool subclass is the collection (see_is_collection), generator class must implementnew(). Otherwise, generator class must implementdup(),new()andto_string()._glob_pattern ( )β Deprecated. See_no_glob_pattern ( ). π old friend, we don't use you anymore._init ( $state )β Instance method. Additional processing when_load()returns no contents ($state is1) or when the spool class is instantiated ($state is0)._is_collection ( )β Instance method, overridable. If the class is collection of spool class, returns true value. By default returns false value.
Collection class does not have store() method. Its content is the set of spool instances.
_load ( )β Instance method, overridable. Loads sorted content of spool. Returns arrayref of marshalled metadatas. By default, returns content of{directory}directory sorted by file name._marshal_format ( )/_marshal_keys ( )/_marshal_regexp ( )β Instance methods, mandatory for filesystem spool._marshal_format()and_marshal_keys()are used to marshal metadata._marshal_keys()and_marshal_regexp()are used to unmarshal metadata. See alsomarshal_metadata()andunmarshal_metadata(). the trio, the whole girl group π€_no_glob_pattern ( )β Class or instance method, overridable for filesystem spool. If it returns false value,glob()is used as much as possible to scan the spool faster. Otherwisereaddir()is used for filesystem spool to get all entries. By default returns false value._store_key ( )β Instance method. If implemented and returns non-empty string,store()returns an item in metadata specified by this method. By defaultstore()returns marshalled metadata (file name on filesystem spool).
π§ Marshaling and unmarshaling metadata
Spool class gives generator class the metadata to instantiate it. On spool based on filesystem, it is typically encoded into file names. For example a file name in incoming spool (Sympa::Spool::Incoming):
listname-owner@domain.name.143599229.12345
encodes the metadata:
localpart => 'listname-owner',
listname => 'listname',
listtype => 'return_path',
domainpart => 'domain.name',
date => 143599229,
Metadata always includes information of context: List, Robot, Site (or Family). For example:
- Message in incoming spool bound for
<listname@domain.name>:
context => Sympa::List <listname@domain.name>,
- Command message in incoming spool bound for
<sympa@domain.name>:
context => 'domain.name',
- Message sent from Sympa to super-listmaster(s):
context => '*'
Context is determined when the generator class is instantiated, and generally never changed through lifetime of instance. Thus, constructor of generator class should take context object as an argument. locked in for life basically π
localpart is encoded in a bit complex manner. yeah it's giving "why is this like this" but here we go:
- If the context is Site or Robot, it is a value of
emailparameter, typically"sympa". - If the context is Family, it is encoded as
@family name. This encoding was added on Sympa 6.2.53b. - If the context is List, it is encoded as local part of list address according to listtype (See also
get_addressin Sympa).
π CONFIGURATION PARAMETERS
Following site configuration parameters in sympa.conf will be referred.
default_list_priorityemailowner_prioritylist_check_suffixlistmaster_emailrequest_priorityreturn_path_suffixsympa_priorityβ Used to extract metadata from marshalled data (file name).umaskβ The umask to make directories of spool.
β SEE ALSO
Sympa::Message, especially Serialization.
ok bestie that's part 1 down π there's more where this came from, so don't go anywhere β we're not done yet, stay tuned π«Άβ¨
π°οΈ HISTORY π°οΈ
okay so story time, bestie, because this class has β¨loreβ¨ π
Sympa::Spool showed up way back on Sympa 6.2. And the whole as the base class era? That started on Sympa 6.2.6. lowkey glow-up energy fr fr π¦
Then the features kept dropping like singles:
build_glob_pattern(),size(),_glob_pattern()and_store_key()all made their debut on Sympa 6.2.8 π iconic lineup, no cap_filter_pre()entered the chat on Sympa 6.2.10 πmarshal(),unmarshal()and the"no_filter"option ofnext()all arrived together on Sympa 6.2.22 β it's giving coordinated release π- and on Sympa 6.2.36,
_no_glob_pattern()was introduced while_glob_pattern()got deprecated π rip boo, you served well
and that's a wrap on the lore dump, bestie π«Ά this page is from Sympa::Spool(3Sympa), version 6.2.80, dated 2026-10-19 β write it down, cite it in your essay, she's a certified classic βπ
π¦ where this page comes from
- fedora 43: sympa-devel-doc 6.2.80-2.fc43 Β· GPL-2.0-or-later AND (OFL-1.1-RFN AND MIT) AND OFL-1.1-RFN AND MIT and (MIT OR GPL-2.0-only)
- fedora 44: sympa-devel-doc 6.2.80-2.fc44 Β· GPL-2.0-or-later AND (OFL-1.1-RFN AND MIT) AND OFL-1.1-RFN AND MIT and (MIT OR GPL-2.0-only)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms