Sympa::Spindle(3Sympa)
π NAME π
Sympa::Spindle β bestie, this is the base class of subclasses that define Sympa workflows. It's giving "everything is built on me" energy. π
β¨ SYNOPSIS β¨
package Sympa::Spindle::FOO;
use base qw(Sympa::Spindle);
use constant _distaff => 'Sympa::Spool::BAR';
sub _twist {
my $self = shift;
my $object = shift;
# Process object...
return 1; # If succeeded.
return 0; # If skipped.
return undef; # If failed.
return ['Sympa::Spindle::BAZ']; # Splicing to the other class(es).
}
1;
π¦ DESCRIPTION π¦
So Sympa::Spindle is the base class for subclasses that define particular workflows of Sympa. Think of it as the blueprint, the blueprint-est blueprint. π«Ά
A spindle class is literally a set of features to process objects. The way that it works: if the spin() method gets called, it retrieves each object from the source spool, processes it, and at last passes the altered object to the appropriate destination (another spool or the mailer), and removes it as necessity. Processing repeats until the source spool is empty. No cap, it just keeps going till there's nothing left to chew on. π
Public methods
new ( [ key => value, ... ] )β the constructor, periodt. Creates a new instance ofSympa::Spindle.spin ( )β instance method. Fetches an object and handles locking it from the source spool, processes them by calling_twist(), and repeats. If the source spool no longer gives content, it returns the number of processed objects. Iconic loop behavior fr fr. π₯add_stash ( =parameters... )β instance method. Adds an arrayref of parameters to a storage for general-purpose. A lil stash, a lil storage, you love to see it.
Properties
An instance of Sympa::Spindle may have the following properties, bestie:
{distaff}β instance of the source spool class that the_distaff()method returns.{finish}β read/write. At first this property is false. Once it is set,spin()finishes processing safely. Emergency brake but make it β¨gracefulβ¨.- Spools β instances of the spool classes that the
_spools()method returns. {start_time}β Unix time in floating point number when processing of the latest message byspin()began. Introduced by Sympa 6.2.13.{stash}β a reference to the array of data added byadd_stash().
Methods subclass should implement
_distaff ( )β class method, mandatory if you want to implementspin(). Returns the name of the source spool class. That source spool class must implementnew()andnext(). No exceptions, it's required. π¨_init ( $state )β instance method. Extra processing for when the spindle class is instantiated ($stateis0), beforespin()processes the next object in the source spool ($stateis1), or after it processed an object ($stateis2).
If it returns a false value, new() will return "undef" (when $state is 0) or spin() will terminate processing (when $state is 1). By default it always returns 1.
_on_garbage ( $handle )β instance method, overridable. Executes a process when an object could not be deserialized (thenew()method of the object failed). By default, it quarantines the object by calling thequarantine()method of the source spool. Garbage goes in the bin, sorry not sorry. ποΈ_on_failure ( $message, $handle )β instance method, overridable. Executes a process when processing of$messagefailed (_twist()returned"undef"). By default, it quarantines the object by calling thequarantine()method of the source spool._on_skip ( $message, $handle )β instance method, overridable. Executes a process when$messagewas skipped (_twist()returned0). By default, it simply unlocks the object by calling theclose()method of$handle._on_success ( $message, $handle )β instance method, overridable. Executes a process when processing of$messagesucceeded (_twist()returned a true value). By default, it removes the object by calling theremove()method of the source spool. Ate. π_spools ( )β class method. If implemented, returns a hashref with names of spool classes related to the spindle as values._twist ( $message )β instance method, mandatory. Processes an object: typically, modifies the object or creates another object and stores it into the appropriate spool.
Parameter:
$messageβ an object.
Returns:
The status of processing: a true value on success; 0 if processing was skipped; "undef" on failure.
As of Sympa 6.2.13, _twist() may also return the reference to an array including name(s) of other classes: in this case spin() and twist() will call the _twist() method of the given classes in order (not coercing the spindle object into them) and uses the returned false value at first or true value at last. Splicing era, iykyk. π
πΈ SEE ALSO πΈ
Sympa::Internals::Workflow, Sympa::Spool.
π HISTORY π
Sympa::Spindle appeared on Sympa 6.2.10. A legend was born, fr fr. β
Okay bestie that's the whole page, every single detail intact, no cap. Now go build a workflow and slay. π
sympa 6.2.80, dated 2026-10-19 β mwah, love that for us. π
π¦ 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