]> xenbits.xensource.com Git - people/aperard/emesinae.git/commitdiff
control: fix "exiting eval via last" issue
authorIan Campbell <ijc@hellion.org.uk>
Thu, 1 Nov 2012 08:51:53 +0000 (09:51 +0100)
committerIan Campbell <ijc@hellion.org.uk>
Thu, 1 Nov 2012 08:51:53 +0000 (09:51 +0100)
Clear up a lot of debuging prints.

Bugs/Bug.pm
config.pl
control.pl

index 912de59cf2d510778d4706e2dfdbcf9008089f9c..ae552f6c87fb4c202b7116c873fbcd6f3b03af2a 100644 (file)
@@ -53,7 +53,6 @@ sub create {
     my $self = $class->new($dbh, ID => $bugid);
 
     my $msg = Bugs::Message->lookup_msgid($dbh, $msgid, Insert => 1);
-    print "Self is ".$msg->{id}."\n";
     $self->add_subthread($msg);
 
     return $self;
@@ -77,7 +76,6 @@ sub addremove_subthread {
     my $add = shift;
     my $m = shift;
 
-    print "addremove $add $m\n";
     my $sth = $self->{dbh}->prepare(q{
         INSERT INTO bug2message (include,bugid,messageid) VALUES (?,?,?)
     });
index 0d585ffac8843f86035b2e7d24b3a6c75a3b4219..9b2fefcecd6240f5bcdef2e1421885451398f530 100644 (file)
--- a/config.pl
+++ b/config.pl
@@ -7,3 +7,5 @@ $c{StyleSheet} = "/css/style.css";
 
 # <MSGID> is replaced by the real message id.
 $c{AltArchive} = "http://marc.info/?i=<MSGID>";
+
+$c{ControlAddress} = "control@foobugs.example.com";
index 63fedd1fc51129a91690d84ae39e6eef7996b2c6..fee71312f61ec99748be08cd2de532cf57c202dd 100755 (executable)
@@ -7,7 +7,7 @@ use Mail::Header;
 
 use Bugs::Bug;
 use Bugs::Message;
-use Bugs::Common qw(readconfig opendb);
+use Bugs::Common;
 
 our $head = Mail::Header->new( \*STDIN );
 
@@ -28,7 +28,6 @@ our $MATCH_BUGID = "-?[0-9]+";
 
 sub parse_msgid {
     my $r = shift;
-    print "Resolving msgid \"$r\"\n";
     if ( $r eq "^" ) {
        if ( defined $head->get('in-reply-to') ) {
            chomp(my $m = $head->get('in-reply-to'));
@@ -37,8 +36,6 @@ sub parse_msgid {
        if (defined $head->get('references')) {
            my $refs = $head->get('references');
            my @refs = split /,\s*/, $refs;
-           print "Refs:\n";
-           print foreach (@refs);
            die "refs";
        }
        die "Cannot resolve message-id `^'\n";
@@ -130,6 +127,9 @@ our %cmds = (
     stop    => \&cmd_quit,
 );
 
+push @reply, "Processing commands for ".$c{ControlAddress}.":";
+push @reply, "";
+
 while (<STDIN>) {
     chomp();
     push @reply, "> $_";
@@ -137,19 +137,23 @@ while (<STDIN>) {
     s/#.*//g;
     next if (m/^$/);
 
+    my $done = 0;
     eval {
        m/(\S+)\s*(.*)/ or die "Failed to parse input.";
        $cmds{$1} or die "Unknown command `$1'.";
-       $cmds{$1}($2) or last;
+       $cmds{$1}($2) or $done = 1;
     };
     if ($@) {
        chomp($@);
        push @reply, "Command failed: $@";
        push @reply, "Stop processing here.";
-       last;
+       $done = 1;
     }
+    last if $done;
 }
 
+### XXX send a reply.
+
 print "$_\n" foreach ( @reply );
 
 print "\nDONE\n\n";