#!/usr/bin/perl -w
# 
# (c) 2001 by Gerfried Fuchs <alfie@ist.org>

use strict;

unlink <Bugs/*.html>;

system ("wget -q -O /tmp/bugs.$$ http://bugs.debian.org/alfie\@debian.org");

my $bugs;
{
   local $/;
   open (IN, "</tmp/bugs.$$") || die "$0: can't open /tmp/bugs.$$: $!\n";
   $bugs = <IN>;
   close IN;
}

$bugs =~ s!"[^"]*bugreport\.cgi\?bug=(\d+)[^"]*"!"Bugs/$1.html"!g;

open (OUT, ">Summe.html") || die "$0: can't write Summe.html: $!\n";
print OUT $bugs;
close OUT;

unlink "/tmp/bugs.$$" || die "$0: can't remove /tmp/bugs.$$: $!\n";

my (@bugreports) = $bugs =~ m!"Bugs/(\d+)\.html"!g;

foreach my $bug (@bugreports) {
   system ("wget -q -O Bugs/$bug.html http://bugs.debian.org/$bug");
}
