new toy

[email protected] Sun, 26 Aug 2001 15:34:01 +0100
Newsgroups perl.bugmongers,perl.bugmongers
Message-ID <[email protected]>
This is still only experimental, but I wanted to see if people were
interested. I'm not sure if it actually closes bugs yet, because
I'm having problems working the email query interface.

In mutt you can pipe messages into it with |close if you stick the
script in your path (and you could presumably bind this to a
key).

Michael

#!/usr/bin/perl -w

use strict;
use Mail::Mailer;
use Mail::Internet;

my $action = ($0 eq 'close') ? 'close' : 'propose_close';

my $bugdb_email = '[email protected]';

my $mail = new Mail::Internet(\*STDIN);

my $mail_head = $mail->head;

# would be useful to put the bug id in X-Perlbug-ID
# Maybe should patch this in the bugtron
my $subject = $mail_head->get('Subject');
chomp $subject;
my $bugid;
if ($subject =~ /\[ID (\d{8}\.\d{3})\]/) {
  $bugid = $1;
} else {
  print STDERR "Couldn't find a bug in this message, giving up\n";
  sleep 1;
  exit 0;
}

my $mailer = new Mail::Mailer;

$mailer->open( {
              To => $bugdb_email, 
              Subject => "-a close b $bugid",
}
);

print $mailer <<ENDIT;

This is an automatically generated message from $0 to close
the perl bug with bugid [$bugid].

ENDIT

$mailer->close;

print STDERR "Closed bugid [$bugid]\n";
sleep 1;
exit 0;