Sympa::Spool(3Sympa) | sympa 6.2.60 | Sympa::Spool(3Sympa) |
Sympa::Spool - Base class of spool classes
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;
This module is the base class for spool subclasses of Sympa.
Parameters:
Parameters:
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.
Parameter:
Returns:
True value if message could be quarantined. Otherwise false value.
If $handle was not a filehandle, this method will die.
Parameter:
Returns:
True value if message could be removed. Otherwise false value.
If $handle was not a filehandle, this method will die.
Parameters:
None.
Returns:
Number of messages.
Note: This method returns the number of messages _load() returns, not applying _filter().
Parameters:
Returns:
If storing succeeded, marshalled metadata (file name) of the message. Otherwise "undef".
Parameters:
Returns:
Hashref containing metadata.
Instance of Sympa::Spool may have following properties.
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 "-request" and "-owner" suffix, this function returns "owner" and "return_path" types, respectively.
The keys "localpart" and "domainpart" are special. Following keys are derived from them: "context", "listname", "listtype", "priority".
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.
This method may modify unmarshalled metadata _and_ deserialized messages include it.
This method may modify marshalled metadata _but_ stored messages are not affected.
Collection class does not have store() method. Its content is the set of spool instances.
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.
"localpart" is encoded in a bit complex manner.
Following site configuration parameters in sympa.conf will be referred.
Sympa::Message, especially Serialization.
Sympa::Spool appeared on Sympa 6.2. It as the base class appeared on Sympa 6.2.6.
build_glob_pattern(), size(), _glob_pattern() and _store_key() were introduced on Sympa 6.2.8. _filter_pre() was introduced on Sympa 6.2.10. marshal(), unmarshal() and "no_filter" option of next() were introduced on Sympa 6.2.22. _no_glob_pattern() was introduced and _glob_pattern() was deprecated on Sympa 6.2.36.
2021-02-07 | 6.2.60 |