--- /dev/null
+package App::Promulger::Command::members;
+use strict;
+use warnings;
+
+use App::Promulger -command;
+use Promulger::List;
+
+sub abstract {
+ return "shows the subscribers to a list";
+}
+
+sub run {
+ my ($self, $opt, $args) = @_;
+ @$args >= 1 or die "pmg members needs a list name\n";
+
+ my $listname = $args->[0];
+ my $list = Promulger::List->resolve($listname);
+
+ if(!$list) {
+ die "$listname doesn't exist\n";
+ }
+
+ for my $subscriber (keys %{ $list->subscribers } ) {
+ print "$subscriber\n";
+ }
+}
+
+'Make it so';
my $listname = $args->[0];
my $list = Promulger::List->new(
listname => $listname,
+ active => 1,
+ subscribers => {},
);
$list->setup;
}
use Path::Class;
use Fcntl ':flock';
use Tie::File;
-use File::Slurp qw/read_file, write_file/;
+use File::Slurp qw/read_file write_file/;
use Data::Dumper;
+use Try::Tiny;
$Data::Dumper::Purity = 1;
use Promulger::Config;
$proto =~ s/-request$//;
my $path = find_path_for($proto);
my $maybe_list;
- eval {
+ try {
$maybe_list = __PACKAGE__->load($path->stringify);
+ } catch {
+ die "oh noes: $_";
};
return $maybe_list;
}
return do $path;
}
+sub get_lists {
+ my ($self) = @_;
+ my $config = Promulger::Config->config;
+ my @lists = map { $_->basename}
+ grep { -f } dir($config->{list_home})->children;
+ s/\.list//g for @lists;
+ return @lists;
+}
+
'http://mitpress.mit.edu/sicp/';