Sympa::Process(3Sympa)

πŸ’– NAME πŸ’–

Sympa::Process β€” the whole entire Process of Sympa, bestie. It's the class that handles Sympa's own process self, no cap.


✨ SYNOPSIS ✨

use Sympa::Process;
my $process = Sympa::Process->instance;
$process->init(pidname => 'sympa');

$process->daemonize;

$process->fork;

🌸 DESCRIPTION 🌸

Sympa::Process implements the class that handles the process itself of Sympa software. She's giving main character energy for the whole process-management situation. πŸ’…

πŸ¦‹ Signal handling πŸ¦‹

The literal second Sympa::Process gets loaded, SIGCHLD signals are captured. And only the defunct child processes that were invoked by the fork() method get reaped β€” so nobody else's zombified babies are getting touched, periodt.

πŸ‘‘ Methods πŸ‘‘

instance ( )

Constructor! Creates a singleton instance of a Sympa::Process object. One of her, that's it, that's the vibe.

Returns:

  • A new Sympa::Process instance, or undef for failure. 😭

init ( key => value, ... )

Instance method. TBD. (Yes bestie, we know, it's giving mysterious. πŸ™ˆ)

daemonize ( )

Instance method. Daemonizes the process itself. The process is given a new process group, detached from TTY, and given a new process ID. Full glow-up, new identity, new everything. ✨

Parameters:

  • None.

Returns:

  • None.

fork ( [ $tag ] )

Instance method. Forks the process. Lowkey important: this method should be used instead of fork() in Perl core. Don't be out here calling the raw one, iykyk.

Parameter:

  • $tag β€” a string to determine the new child process. By default the name of the calling process.

Returns:

  • See "fork" in perlfunc.

reap_child ( [ blocking => 1 ] )

DEPRECATED. Like, retired. She said she's not doing that anymore. πŸ’€

wait_child ( )

Instance method. Waits for any child process. Just sitting there patiently, holding space. 🫢

Parameters:

  • None.

Returns:

  • 0. Returns -1 on failure.

sync_child ( [ hash => \%hash ], [ file => 1 ] )

Updates process information in external data. Keeping everyone's info cute and current. πŸŽ€

Parameters:

  • hash => \%hash β€” syncs PIDs in local map %hash
  • file => 1 β€” syncs child PIDs in PID file. If a dead PID is found, notification will be sent to super-listmaster. (Not me snitching on the dead PIDs 😭)

Returns:

  • None.

remove_pid ([ pid => $pid ], [ final => 1 ] )

Instance method. Removes the process ID from the PID file. Then if the file is empty, it will be removed. Clean girl aesthetic β€” no clutter. ✨

write_pid ( [ initial => 1 ], [ pid => $pid ] )

Instance method. Writes or adds a process ID to the PID file.

Parameters:

  • initial => 1 β€” initializes PID file. If the file remains, notification will be sent to super-listmaster. πŸ‘€
  • pid => $pid β€” process ID to be written. By default the PID of the current process.

direct_stderr_to_file ( )

Instance method. TBD. 🌈

πŸ’œ Attributes πŸ’œ

A Sympa::Process instance may have the following attributes:

  • {children} β€” hashref with child PIDs forked by the fork() method as keys. Her little registry of kids. 🍼
  • {detached} β€” a true value is set if the daemonize() method was called and the process has been detached from TTY.
  • {generation} β€” generation of process. If the fork() method succeeds, it will be increased by the child process.

🌈 Utility functions 🌈

eval_in_time ( $subref, $timeout )

Evaluate subroutine $subref in $timeout seconds.

TBD. ⭐

register_handler ( )

Registers the SIGCHLD handler. This function is usually called automatically during initialization. She handles it herself, you don't gotta lift a finger. πŸ’…


πŸ•°οΈ HISTORY πŸ•°οΈ

  • Sympa::Tools::Daemon appeared on Sympa 6.2a.41.
  • Renamed Sympa::Process appeared on Sympa 6.2.12 and began to provide OO interface. Glow-up era. πŸ‘‘
  • Sympa 6.2.13 introduced the daemonize() method and the {detached} attribute.
  • As of Sympa 6.2.14, SIGCHLD signal was captured and child processes were reaped immediately. The reap_child() method (formerly reaper()) was deprecated.

That's the whole page bestie, you ate it up fr fr. πŸ’– This was documented from sympa version 6.2.80, dated 2026-10-19, and it lives in the Sympa::Process(3Sympa) manual. Go forth and manage those processes, queen. πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from