Sympa::CLI(3Sympa)
π Sympa::CLI π
okay bestie, pull up a chair, because we're about to talk about Sympa::CLI β that's the manual page Sympa::CLI(3Sympa) if you're keeping track β and it's literally the base class of all the Sympa CLI modules. the blueprint. the mother of all command-line glow-ups. β¨
πΈ NAME πΈ
Sympa::CLI β Base class of Sympa CLI modules
like, it's the parent class. everything else is just out here inheriting its whole vibe. π«Ά
β¨ SYNOPSIS β¨
package Sympa::CLI::mycommand;
use parent qw(Sympa::CLI);
use constant _options => qw(...);
use constant _args => qw(...);
use constant _need_priv => 0;
sub _run {
my $class = shift;
my $options = shift;
my @argv = @_;
#... Do the job...
exit 0;
}
and boom β this will implement the function of sympa mycommand. no cap, that's the whole magic trick. π
π¦ DESCRIPTION π¦
Sympa::CLI is the base class of the classes which defines particular command of command line utility. TBD.
(yes bestie, it literally says TBD in the source. the docs are still cooking. π)
π Methods subclass should implement π
these are the methods your subclass is expected to bring to the function. main character responsibilities only. π
_options ( )β Class method, overridable. Returns an array to define command line options. About the format see"Summary of Option Specifications"inGetopt::Long.
Additionally, underscores "_" in the long options are also recognized as hyphen-minus "-".
By default general options are defined and they always take precedence over the definition in subclass.
_args ( )β Class method, overridable. Returns an array to define mandatory arguments. TBD.
By default no mandatory arguments are defined.
_need_priv ( )β Class method, overridable. If this returns true value (the default), the program tries getting privileges of Sympa user, prepare database connection, loading main configuration and then setting language according to configuration. Otherwise, it sets language according to locale setting of console._log_to_stderr ( )β Class method, overridable. If this returns true value, output by logging facility will be redirected to standard error output (stderr).
By default redirection is disabled.
_run ( \$options, @argv )β Class method, mandatory. If the program is invoked, command line options are parsed as_options()defines, arguments are checked as_args()defines and this method is called.
bestie, notice how _run says mandatory? yeah. you don't skip that one. it's the whole point. π
π§ Subcommands π§
want a subcommand? it's giving inheritance, and honestly it's so easy:
To implement a subcommand, simply create a submodule inheriting the module for parent command:
package Sympa::CLI::mycommand::subcommand;
use parent qw(Sympa::CLI::mycommand);
...
Then this will implement the function of sympa mycommand subcommand.
like?? nesting submodules into submodules?? we love a family tree. π
π₯ SEE ALSO π₯
π HISTORY π
Sympa::CLI appeared on Sympa 6.2.68.
and that's the whole page, bestie!! mwah π this was documented under sympa 6.2.80, dated 2026-10-19 β so go forth, subclass responsibly, and remember: your _run method is mandatory. periodt. πβ¨
π¦ 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