The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/bin/perl -w
###########################################
# rmpost - Remove a post
# Mike Schilli, 2005 (m@perlmeister.com)
###########################################
use strict;
use Log::Log4perl qw(:easy);
use Pod::Usage;
use WWW::Mechanize::Pluggable;
use Getopt::Long 2.35;

GetOptions(\my %opts,
    "url=s", "pass=s", "user=s", "post=i");

if(grep { ! defined $opts{$_} } qw(url pass user post)) {
    pod2usage("Parameter missing");
}

Log::Log4perl->easy_init($DEBUG);

my $mech = new WWW::Mechanize::Pluggable;
$mech->get($opts{url});

$mech->phpbb_login($opts{user}, $opts{pass});

$mech->get("$opts{url}/viewtopic.php?p=$opts{post}");
$mech->phpbb_post_remove($opts{post});

__END__

=head1 NAME

    rmpost - Delete a post from a phpbb forum

=head1 SYNOPSIS

    rmpost -url=URL -user=USERID -pass=PASSWD -post=NNN

=head1 DESCRIPTION

C<rmpost> removes a post from phpbb forum by logging into the forum
under URL as a forum admin, and clicking the buttons until a specified post
has been deleted. Very handy to combat the phpbb spammers.

=head1 EXAMPLES

  $ rmpost -url=http://xyz.com/forum -user=admin -pass=xxx -post=123

=head1 LEGALESE

Copyright 2006 by Mike Schilli, all rights reserved.
This program is free software, you can redistribute it and/or
modify it under the same terms as Perl itself.

=head1 AUTHOR

2006, Mike Schilli <cpan@perlmeister.com>