NAME

Sietima::CmdLine - run Sietima as a command-line application

VERSION

version 1.0.2

SYNOPSIS

use Sietima::CmdLine;

Sietima::CmdLine->new({
  traits => [qw(SubjectTag)],
  args => {
    return_path => 'list@example.net',
    subject_tag => 'Test',
    subscribers => \@addresses,
})->run;

DESCRIPTION

This class simplifies the creation of a Sietima object, and uses App::Spec to provide a command-line interface to it.

ATTRIBUTES

sietima

Required, an instance of Sietima. You can either construct it yourself, or use the simplified building provided by the constructor.

extra_spec

Optional hashref. Used inside "app_spec". If you're not familiar with App::Spec, you probably don't want to touch this.

METHODS

new

my $cmdline = Sietima::CmdLine->new({
  sietima => Sietima->with_traits(qw(SubjectTag))->new({
    return_path => 'list@example.net',
    subject_tag => 'Test',
    subscribers => \@addresses,
  }),
});

my $cmdline = Sietima::CmdLine->new({
  traits => [qw(SubjectTag)],
  args => {
    return_path => 'list@example.net',
    subject_tag => 'Test',
    subscribers => \@addresses,
});

The constructor. In alternative to passing a Sietima instance, you can pass traits and args, and the instance will be built for you. The two calls above are equivalent.

app_spec

Returns an instance of App::Spec, built from the specification returned by calling command_line_spec on the "sietima" object, modified by the "extra_spec". This method, and the extra_spec attribute, are probably only interesting to people who are doing weird extensions.

runner

Returns an instance of Sietima::Runner, built from the "app_spec".

run

Delegates to the "runner"'s run method.

Parser the command line arguments from @ARGV and executes the appropriate action.

AUTHOR

Gianni Ceccarelli <dakkar@thenautilus.net>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Gianni Ceccarelli <dakkar@thenautilus.net>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.