.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Sympa::Spool 3Sympa" .TH Sympa::Spool 3Sympa "2023-01-26" "6.2.70" "sympa 6.2.70" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Sympa::Spool \- Base class of spool classes .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& package Sympa::Spool::FOO; \& \& use base qw(Sympa::Spool); \& \& sub _directories { \& return { \& directory => \*(Aq/path/to/spool\*(Aq, \& bad_directory => \*(Aq/path/to/spool/bad\*(Aq, \& }; \& } \& use constant _generator => \*(AqSympa::Message\*(Aq; \& use constant _marshal_format => \*(Aq%s@%s.%ld.%ld,%d\*(Aq; \& use constant _marshal_keys => [qw(localpart domainpart date PID RAND)]; \& use constant _marshal_regexp => \& qr{\eA([^\es\e@]+)(?:\e@([\ew\e.\e\-]+))?\e.(\ed+)\e.(\ew+)(?:,.*)?\ez}; \& \& 1; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module is the base class for spool subclasses of Sympa. .SS "Public methods" .IX Subsection "Public methods" .IP "new ( [ options... ] )" 4 .IX Item "new ( [ options... ] )" \&\fIConstructor\fR. Creates new instance of the class. .ie n .IP "marshal ( $message, [ keep_keys => 1 ] )" 4 .el .IP "marshal ( \f(CW$message\fR, [ keep_keys => 1 ] )" 4 .IX Item "marshal ( $message, [ keep_keys => 1 ] )" \&\fIInstance method\fR. Gets marshalled key (file name) of the message. .Sp Parameters: .RS 4 .ie n .IP "$message" 4 .el .IP "\f(CW$message\fR" 4 .IX Item "$message" Message to be marshalled. .IP "keep_keys => 1" 4 .IX Item "keep_keys => 1" See \fBmarshal_metadata()\fR. .RE .RS 4 .RE .IP "next ( [ no_filter => 1 ], [ no_lock => 1 ] )" 4 .IX Item "next ( [ no_filter => 1 ], [ no_lock => 1 ] )" \&\fIInstance method\fR. 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. .Sp Parameters: .RS 4 .IP "no_filter => 1" 4 .IX Item "no_filter => 1" Won't skip messages when filter defined by \fB_filter()\fR returns false. .IP "no_lock => 1" 4 .IX Item "no_lock => 1" Won't lock messages. .RE .RS 4 .Sp Returns: .Sp Two-elements list of message instance and filehandle locking a message. If parsing message fails, list of \f(CW\*(C`undef\*(C'\fR and filehandle. If no more message found, empty array. .Sp If \f(CW\*(C`no_lock\*(C'\fR is set, true scalar value will be returned in place of filehandle. .RE .ie n .IP "quarantine ( $handle )" 4 .el .IP "quarantine ( \f(CW$handle\fR )" 4 .IX Item "quarantine ( $handle )" \&\fIInstance method\fR. Quarantines a message. On filesystem spool, message will be moved into \f(CW\*(C`{bad_directory}\*(C'\fR of the spool using \fBrename()\fR. .Sp Parameter: .RS 4 .ie n .IP "$handle" 4 .el .IP "\f(CW$handle\fR" 4 .IX Item "$handle" Filehandle, Sympa::LockedFile instance, locking message. .RE .RS 4 .Sp Returns: .Sp True value if message could be quarantined. Otherwise false value. .Sp If \f(CW$handle\fR was not a filehandle, this method will die. .RE .ie n .IP "remove ( $handle )" 4 .el .IP "remove ( \f(CW$handle\fR )" 4 .IX Item "remove ( $handle )" \&\fIInstance method\fR. Removes a message. .Sp Parameter: .RS 4 .ie n .IP "$handle" 4 .el .IP "\f(CW$handle\fR" 4 .IX Item "$handle" Filehandle, Sympa::LockedFile instance, locking message. .RE .RS 4 .Sp Returns: .Sp True value if message could be removed. Otherwise false value. .Sp If \f(CW$handle\fR was not a filehandle, this method will die. .RE .IP "size ( )" 4 .IX Item "size ( )" \&\fIInstance method\fR. Gets the number of messages the spool contains. .Sp Parameters: .Sp None. .Sp Returns: .Sp Number of messages. .Sp Note: This method returns the number of messages \fB_load()\fR returns, not applying \fB_filter()\fR. .ie n .IP "store ( $message, [ original => $original ] )" 4 .el .IP "store ( \f(CW$message\fR, [ original => \f(CW$original\fR ] )" 4 .IX Item "store ( $message, [ original => $original ] )" \&\fIInstance method\fR. Stores the message into spool. .Sp Parameters: .RS 4 .ie n .IP "$message" 4 .el .IP "\f(CW$message\fR" 4 .IX Item "$message" Message to be stored. .ie n .IP "original => $original" 4 .el .IP "original => \f(CW$original\fR" 4 .IX Item "original => $original" If true value is specified and \f(CW$message\fR was decrypted, Stores original encrypted form. .RE .RS 4 .Sp Returns: .Sp If storing succeeded, marshalled metadata (file name) of the message. Otherwise \f(CW\*(C`undef\*(C'\fR. .RE .ie n .IP "unmarshal ( $marshalled )" 4 .el .IP "unmarshal ( \f(CW$marshalled\fR )" 4 .IX Item "unmarshal ( $marshalled )" \&\fIInstance method\fR. Gets metadata from marshalled key (file name). .Sp Parameters: .RS 4 .ie n .IP "$marshalled" 4 .el .IP "\f(CW$marshalled\fR" 4 .IX Item "$marshalled" Marshalled key. .RE .RS 4 .Sp Returns: .Sp Hashref containing metadata. .RE .SS "Properties" .IX Subsection "Properties" Instance of Sympa::Spool may have following properties. .IP "Directories" 4 .IX Item "Directories" Directories \fB_directories()\fR method returns: \&\f(CW\*(C`{directory}\*(C'\fR, \f(CW\*(C`{bad_directory}\*(C'\fR and so on. .SS "Low level functions" .IX Subsection "Low level functions" .ie n .IP "build_glob_pattern ( $marshal_format, $marshal_keys, [ key => value, ... ] )" 4 .el .IP "build_glob_pattern ( \f(CW$marshal_format\fR, \f(CW$marshal_keys\fR, [ key => value, ... ] )" 4 .IX Item "build_glob_pattern ( $marshal_format, $marshal_keys, [ key => value, ... ] )" \&\fIFunction\fR. Builds a glob pattern from parameters and returns it. If built pattern is empty or contains only punctuations, i.e. \f(CW\*(C`[^0\-9A\-Za\-z\ex80\-\exFF]\*(C'\fR, will return \f(CW\*(C`undef\*(C'\fR. .ie n .IP "split_listname ( $robot, $localpart )" 4 .el .IP "split_listname ( \f(CW$robot\fR, \f(CW$localpart\fR )" 4 .IX Item "split_listname ( $robot, $localpart )" \&\fIFunction\fR. Split local part of e\-mail to list name and type. Returns an array \f(CW\*(C`(name, type)\*(C'\fR. Note that the list with returned name may or may not exist. .Sp If local part looks like listmaster or sympa address, name is \f(CW\*(C`undef\*(C'\fR and type is either \f(CW\*(Aqlistmaster\*(Aq\fR or \f(CW\*(Aqsympa\*(Aq\fR. Otherwise, type is either \f(CW\*(Aqeditor\*(Aq\fR, \f(CW\*(Aqowner\*(Aq\fR, \f(CW\*(Aqreturn_path\*(Aq\fR, \&\f(CW\*(Aqsubscribe\*(Aq\fR, \f(CW\*(Aqunsubscribe\*(Aq\fR, \f(CW\*(AqUNKNOWN\*(Aq\fR or \f(CW\*(C`undef\*(C'\fR. .Sp Note: For \f(CW\*(C`\-request\*(C'\fR and \f(CW\*(C`\-owner\*(C'\fR suffix, this function returns \&\f(CW\*(C`owner\*(C'\fR and \f(CW\*(C`return_path\*(C'\fR types, respectively. .ie n .IP "store_spool ( $spool_dir, $message, $marshal_format, $marshal_keys, [ key => value, ... ] )" 4 .el .IP "store_spool ( \f(CW$spool_dir\fR, \f(CW$message\fR, \f(CW$marshal_format\fR, \f(CW$marshal_keys\fR, [ key => value, ... ] )" 4 .IX Item "store_spool ( $spool_dir, $message, $marshal_format, $marshal_keys, [ key => value, ... ] )" \&\fIFunction\fR. Store \f(CW$message\fR into directory \f(CW$spool_dir\fR as a file with name as marshalled metadata using \f(CW$marshal_format\fR and \f(CW$marshal_keys\fR. .ie n .IP "unmarshal_metadata ( $spool_dir, $marshalled, $marshal_regexp, $marshal_keys )" 4 .el .IP "unmarshal_metadata ( \f(CW$spool_dir\fR, \f(CW$marshalled\fR, \f(CW$marshal_regexp\fR, \f(CW$marshal_keys\fR )" 4 .IX Item "unmarshal_metadata ( $spool_dir, $marshalled, $marshal_regexp, $marshal_keys )" \&\fIFunction\fR. Unmarshals metadata. Returns hashref with keys in arrayref \f(CW$marshal_keys\fR and values with substrings captured by regexp \f(CW$marshal_regexp\fR. If \f(CW$marshalled\fR did not match against \f(CW$marshal_regexp\fR, returns \f(CW\*(C`undef\*(C'\fR. .Sp The keys \f(CW\*(C`localpart\*(C'\fR and \f(CW\*(C`domainpart\*(C'\fR are special. Following keys are derived from them: \&\f(CW\*(C`context\*(C'\fR, \f(CW\*(C`listname\*(C'\fR, \f(CW\*(C`listtype\*(C'\fR, \f(CW\*(C`priority\*(C'\fR. .ie n .IP "marshal_metadata ( $message, $marshal_format, $marshal_keys, [ keep_keys => 1 ] )" 4 .el .IP "marshal_metadata ( \f(CW$message\fR, \f(CW$marshal_format\fR, \f(CW$marshal_keys\fR, [ keep_keys => 1 ] )" 4 .IX Item "marshal_metadata ( $message, $marshal_format, $marshal_keys, [ keep_keys => 1 ] )" \&\fIFunction\fR. Marshals metadata. Returns formatted string by \fBsprintf()\fR using \f(CW$marshal_format\fR and metadatas indexed by keys in arrayref \f(CW$marshal_keys\fR. .Sp If key is uppercase, it means auto-generated value: \&\f(CW\*(AqAUTHKEY\*(Aq\fR, \f(CW\*(AqKEYAUTH\*(Aq\fR, \f(CW\*(AqPID\*(Aq\fR, \f(CW\*(AqRAND\*(Aq\fR, \f(CW\*(AqTIME\*(Aq\fR. Otherwise it means metadata or property of \f(CW$message\fR. If \f(CW\*(C`keep_keys\*(C'\fR option (added on 6.2.23b) is set, forces using latter. .Sp \&\fBsprintf()\fR is executed under \f(CW\*(C`C\*(C'\fR locale: Full stop (\f(CW\*(C`.\*(C'\fR) is always used for decimal point in floating point number. .SS "Methods subclass should implement" .IX Subsection "Methods subclass should implement" .IP "_create ( )" 4 .IX Item "_create ( )" \&\fIInstance method\fR, \fIoverridable\fR. Creates spool. By default, creates directories returned by \fB_directories()\fR. .IP "_directories ( [ options, ... ] )" 4 .IX Item "_directories ( [ options, ... ] )" \&\fIClass or instance method\fR, \fImandatory for filesystem spool\fR. Returns hashref with directory paths related to the spool as values. It must have keys at least \f(CW\*(C`directory\*(C'\fR and (if you wish to implement \fBquarantine()\fR method) \f(CW\*(C`bad_directory\*(C'\fR. .ie n .IP "_filter ( $metadata )" 4 .el .IP "_filter ( \f(CW$metadata\fR )" 4 .IX Item "_filter ( $metadata )" \&\fIInstance method\fR, \fIoverridable\fR. If it returned false value, processing of \f(CW$metadata\fR by \fBnext()\fR will be skipped. By default, always returns true value. .Sp This method may modify unmarshalled metadata _and_ deserialized messages include it. .ie n .IP "_filter_pre ( $metadata )" 4 .el .IP "_filter_pre ( \f(CW$metadata\fR )" 4 .IX Item "_filter_pre ( $metadata )" \&\fIInstance method\fR, \fIoverridable\fR. If it returned false value, processing of \f(CW$metadata\fR by \fBstore()\fR will be skipped. By default, always returns true value. .Sp This method may modify marshalled metadata _but_ stored messages are not affected. .IP "_generator ( )" 4 .IX Item "_generator ( )" \&\fIClass or instance method\fR, \fImandatory\fR. 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 implement \fBnew()\fR. Otherwise, generator class must implement \fBdup()\fR, \fBnew()\fR and \fBto_string()\fR. .IP "_glob_pattern ( )" 4 .IX Item "_glob_pattern ( )" Deprecated. See _no_glob_pattern ( ) .ie n .IP "_init ( $state )" 4 .el .IP "_init ( \f(CW$state\fR )" 4 .IX Item "_init ( $state )" \&\fIInstance method\fR. Additional processing when \fB_load()\fR returns no contents ($state is 1) or when the spool class is instantiated ($state is 0). .IP "_is_collection ( )" 4 .IX Item "_is_collection ( )" \&\fIInstance method\fR, \fIoverridable\fR. If the class is collection of spool class, returns true value. By default returns false value. .Sp Collection class does not have \fBstore()\fR method. Its content is the set of spool instances. .IP "_load ( )" 4 .IX Item "_load ( )" \&\fIInstance method\fR, \fIoverridable\fR. Loads sorted content of spool. Returns arrayref of marshalled metadatas. By default, returns content of \f(CW\*(C`{directory}\*(C'\fR directory sorted by file name. .IP "_marshal_format ( )" 4 .IX Item "_marshal_format ( )" .PD 0 .IP "_marshal_keys ( )" 4 .IX Item "_marshal_keys ( )" .IP "_marshal_regexp ( )" 4 .IX Item "_marshal_regexp ( )" .PD \&\fIInstance methods\fR, \fImandatory for filesystem spool\fR. \&\fB_marshal_format()\fR and \fB_marshal_keys()\fR are used to marshal metadata. \&\fB_marshal_keys()\fR and \fB_marshal_regexp()\fR are used to unmarshal metadata. See also \fBmarshal_metadata()\fR and \fBunmarshal_metadata()\fR. .IP "_no_glob_pattern ( )" 4 .IX Item "_no_glob_pattern ( )" \&\fIClass or instance method\fR, \fIoverridable for filesystem spool\fR. If it returns false value, \&\fBglob()\fR is used as much as possible to scan the spool faster. Otherwise \fBreaddir()\fR is used for filesystem spool to get all entries. By default returns false value. .IP "_store_key ( )" 4 .IX Item "_store_key ( )" \&\fIInstance method\fR. If implemented and returns non-empty string, \&\fBstore()\fR returns an item in metadata specified by this method. By default \fBstore()\fR returns marshalled metadata (file name on filesystem spool). .SS "Marshaling and unmarshaling metadata" .IX Subsection "Marshaling and unmarshaling metadata" Spool class gives generator class the \fBmetadata\fR 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) .PP .Vb 1 \& listname\-owner@domain.name.143599229.12345 .Ve .PP encodes the metadata .PP .Vb 5 \& localpart => \*(Aqlistname\-owner\*(Aq, \& listname => \*(Aqlistname\*(Aq, \& listtype => \*(Aqreturn_path\*(Aq, \& domainpart => \*(Aqdomain.name\*(Aq, \& date => 143599229, .Ve .PP Metadata always includes information of \fBcontext\fR: List, Robot, Site (or Family). For example: .PP \&\- Message in incoming spool bound for : .PP .Vb 1 \& context => Sympa::List , .Ve .PP \&\- Command message in incoming spool bound for : .PP .Vb 1 \& context => \*(Aqdomain.name\*(Aq, .Ve .PP \&\- Message sent from Sympa to super\-listmaster(s): .PP .Vb 1 \& context => \*(Aq*\*(Aq .Ve .PP 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. .PP \&\f(CW\*(C`localpart\*(C'\fR is encoded in a bit complex manner. .IP "\(bu" 4 If the context is Site or Robot, it is a value of \f(CW\*(C`email\*(C'\fR parameter, typically "\f(CW\*(C`sympa\*(C'\fR". .IP "\(bu" 4 If the context is Family, it is encoded as \f(CW\*(C`@\f(CIfamily name\f(CW\*(C'\fR. This encoding was added on Sympa 6.2.53b. .IP "\(bu" 4 If the context is List, it is encoded as local part of list address according to listtype (See also \*(L"get_address\*(R" in Sympa). .SH "CONFIGURATION PARAMETERS" .IX Header "CONFIGURATION PARAMETERS" Following site configuration parameters in sympa.conf will be referred. .IP "default_list_priority" 4 .IX Item "default_list_priority" .PD 0 .IP "email" 4 .IX Item "email" .IP "owner_priority" 4 .IX Item "owner_priority" .IP "list_check_suffix" 4 .IX Item "list_check_suffix" .IP "listmaster_email" 4 .IX Item "listmaster_email" .IP "request_priority" 4 .IX Item "request_priority" .IP "return_path_suffix" 4 .IX Item "return_path_suffix" .IP "sympa_priority" 4 .IX Item "sympa_priority" .PD Used to extract metadata from marshalled data (file name). .IP "umask" 4 .IX Item "umask" The umask to make directories of spool. .SH "SEE ALSO" .IX Header "SEE ALSO" Sympa::Message, especially Serialization. .SH "HISTORY" .IX Header "HISTORY" Sympa::Spool appeared on Sympa 6.2. It as the base class appeared on Sympa 6.2.6. .PP \&\fBbuild_glob_pattern()\fR, \fBsize()\fR, \fB_glob_pattern()\fR and \fB_store_key()\fR were introduced on Sympa 6.2.8. \&\fB_filter_pre()\fR was introduced on Sympa 6.2.10. \&\fBmarshal()\fR, \fBunmarshal()\fR and \f(CW\*(C`no_filter\*(C'\fR option of \fBnext()\fR were introduced on Sympa 6.2.22. \&\fB_no_glob_pattern()\fR was introduced and \fB_glob_pattern()\fR was deprecated on Sympa 6.2.36.