member.
use App::Cmd::Setup -app;
+use Promulger::Config;
+
+sub global_opt_spec {
+ return (
+ [ "config|c=s", "configuration file", { required => 1 } ],
+ );
+}
+
1;
use Promulger::Config;
-sub opt_spec {
- return (
- [ "config|c=s", "configuration file", { required => 1 } ],
- );
-}
-
sub validate_args {
my ($self, $opt, $args) = @_;
- my $cf = $opt->{config};
+ my $cf = $self->app->global_options->{config};
unless(-e $cf) {
die "Config file $cf doesn't exist\n";
--- /dev/null
+package App::Promulger::Command::rmsub;
+use strict;
+use warnings;
+
+use App::Promulger -command;
+use Promulger::List;
+
+sub abstract {
+ return "subscribes a user to a list";
+}
+
+sub run {
+ my ($self, $opt, $args) = @_;
+ @$args >= 2 or die "pmg newsub needs a list name and a departing member\n";
+
+ my $listname = $args->[0];
+ my $list = Promulger::List->resolve($listname);
+
+ if(!$list) {
+ die "$listname doesn't exist\n";
+ }
+
+ my $ex_sub = $args->[1];
+ $list->unsubscribe($ex_sub);
+}
+
+'Make it so';
[ $self->show_subscriber($list, $subscriber) ]
]
},
- sub (GET + /list/*/subscriber/*/unsubscribe) {
+ sub (POST + /list/*/subscriber/*/unsubscribe) {
my ($self, $list, $subscriber) = @_;
[
200,
method show_subscriber($list_name, $subscriber) {
my $html = <<"HTML";
<p>Subscriber ${subscriber}</p>
-<a href="/list/${list_name}/subscriber/${subscriber}/unsubscribe">unsubscribe</a>
+<form method="POST" action="/list/${list_name}/subscriber/${subscriber}/unsubscribe">
+<input type="submit" value="Unsubscribe">
+</form>
HTML
}