Wizzow!
Yesterday was Kwiki fury on CPAN. The new Kwiki has been released, and If you've installed it, you know that the Kwiki only provides a very mininmal, bare-bones wiki. Everything is a plugin, and between Brian and I there are fourteen plugins on CPAN -- with more to come. Luckily, by now most of the Kwiki core stuff has propagated:
Kwiki::Weather, Kwiki::Autoformat and Kwiki::VimMode are also up, Kwiki::PerlMode and Kwiki::PodMode are on the way from Brian.
I am also planning on marking Text::KwikiFormatish, which uses the old (Something I'm planning on implementing...)
Anyway, I usually paste some sort of handy code, so here it is. I hate having to open up a browser to delete spam sent to our moderated Mailman mailing list. That, combined with the prowess of Andy Lester and his WWW::Mechanize module, gives me this:
#!/arch/unix/bin/perl
use strict;
use warnings;
#
# listmod - fast alternative to mailman list interface
#
# usage: listmod crew XXXXXXXX
#
die "usage: $0 <listname> <password>\n" unless @ARGV == 2;
my ($listname, $password) = @ARGV;
use CGI qw(unescape);
use WWW::Mechanize;
my $m = WWW::Mechanize->new();
use Term::ReadLine;
my $term = Term::ReadLine->new($0);
# submit the form, get the cookie, go to the list admin page
$m->get("https://lists.ccs.neu.edu/bin/admindb/$listname");
$m->set_visib le( $password );
$m->click;
# exit if nothing to do
print "There are no pending requests.\n" and exit
if $m->content =~/There are no pending requests/;
# select the first form and examine its contents
$m->form_number(1);
my $f = $m->current_form or die "Couldn't get first form!\n";
# get me the base form element for each email item
my @items = map {m/^.+?-(.+)/} grep {m/senderbanp/} $f->param
or die "Couldn't get items in first form!\n";
# iterate through items, prompt user, commit actions
foreach my $item (@items) {
# show item info
my $sender = unescape($item);
my ($subject) = [$f->find_input("senderbanp-$item")->value_names]->[1]
=~/Subject:\s+(.+?)\s+Size:/g;
# prompt user
my $choice = '';
while ( $choice !~/^[DAX]$/ ) {
print "$sender\: '$subject'\n";
$choice = uc $term->readline("Action: defer/accept/discard [dax]: ");
print "\n\n";
}
# set button
$m->field("senderaction-$item" => {D=>0,A=>1,X=>3}->{$choice});
}
# submit actions
$m->click;
Mech check (Score:2)
--
xoa
Re:Mech check (Score:1)
qw(Ian Langworth)