diff options
author | dakkar <dakkar@thenautilus.net> | 2016-12-27 15:27:23 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2016-12-27 15:30:09 +0000 |
commit | 2362fc13b8e79618e285d9cd1817819381d7d0a4 (patch) | |
tree | 9b70332a18ecb111905529d9e07f397c2256d0f2 /lib/Sietima.pm | |
parent | update dependencies (diff) | |
download | Sietima-2362fc13b8e79618e285d9cd1817819381d7d0a4.tar.gz Sietima-2362fc13b8e79618e285d9cd1817819381d7d0a4.tar.bz2 Sietima-2362fc13b8e79618e285d9cd1817819381d7d0a4.zip |
command line handling
Diffstat (limited to 'lib/Sietima.pm')
-rw-r--r-- | lib/Sietima.pm | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/Sietima.pm b/lib/Sietima.pm index df5de4e..81821e4 100644 --- a/lib/Sietima.pm +++ b/lib/Sietima.pm @@ -49,6 +49,12 @@ has transport => ( ); sub _build_transport { Email::Sender::Simple->default_transport } +sub handle_mail_from_stdin($self) { + my $mail_text = do { local $/; <> }; + my $incoming_mail = Email::MIME->new(\$mail_text); + return $self->handle_mail($incoming_mail); +} + sub handle_mail($self,$incoming_mail) { state $check = compile(Object,EmailMIME); $check->(@_); @@ -91,4 +97,26 @@ sub send_message($self,$outgoing_message) { sub _trait_namespace { 'Sietima::Role' } +sub command_line_spec($self) { + return { + name => 'sietima', + title => 'a simple mailing list manager', + options => [ + { + name => 'verbose', + summary => 'more chatty', + type => 'flag', + multiple => 1, + aliases => ['v'], + }, + ], + subcommands => { + send => { + op => 'handle_mail_from_stdin', + summary => 'send email from STDIN', + }, + }, + }; +} + 1; |