GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Sympa::CLI(3Sympa) sympa 6.2.76 Sympa::CLI(3Sympa)

Sympa::CLI - Base class of Sympa CLI modules

  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;
  }

This will implement the function of sympa mycommand.

Sympa::CLI is the base class of the classes which defines particular command of command line utility. TBD.

_options ( )
Class method, overridable. Returns an array to define command line options. About the format see "Summary of Option Specifications" in Getopt::Long.

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.

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.

sympa(1).

Sympa::CLI appeared on Sympa 6.2.68.

2025-02-03 6.2.76

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.