BUG INTRODUCED from a6c36a2b97f6bed5577d66474949c8ec8b32c8e8
the signal handler is essential for this bot
the script performs a kill -TERM and the application has enough time to finish the connection.
it's essential.
committer: Markus Bröker <mbroeker@largo.homelinux.org>
#!/usr/bin/perl -W
use strict;
my $line;
my $a;
my $b;
print "CONTENT-TYPE: text/html\n\n";
print "<html>\n\t<head>\n\t\t<title>Factoids</title>\n\t</head>\n<body>\n";
open(FD, "dbtool -l |") or die("Cannot open file");
foreach $line(<FD>) {
($a, $b) = split(/:/, $line, 2);
$a =~ s/^[\t ]+//; # skip blanks
$b =~ s/^[\t ]+//; # skip blanks
$b =~ s/[\n]+//; # for html source :)
if ($b) {
if($b =~ /^http/ ) {
print "$a - <a href=\"$b\">$b</a><br>";
} else {
print "$a - $b<br>";
}
}
}
print "\n<br>$a\n";
print "</body></html>\n";
close(FD);