author | Markus Bröker <mbroeker@largo.dyndns.tv> |
Tue, 02 Feb 2010 12:50:52 +0100 | |
changeset 40 | 5b7e8dba46a0 |
parent 33 | 56571d34d754 |
permissions | -rwxr-xr-x |
0 | 1 |
#!/usr/bin/perl -W |
2 |
||
3 |
use strict; |
|
4 |
||
5 |
my $line; |
|
6 |
my $a; |
|
7 |
my $b; |
|
8 |
||
9 |
print "CONTENT-TYPE: text/html\n\n"; |
|
10 |
||
11 |
print "<html>\n\t<head>\n\t\t<title>Factoids</title>\n\t</head>\n<body>\n"; |
|
12 |
open(FD, "dbtool -l |") or die("Cannot open file"); |
|
13 |
||
14 |
foreach $line(<FD>) { |
|
15 |
($a, $b) = split(/:/, $line, 2); |
|
16 |
$a =~ s/^[\t ]+//; # skip blanks |
|
17 |
$b =~ s/^[\t ]+//; # skip blanks |
|
18 |
$b =~ s/[\n]+//; # for html source :) |
|
19 |
||
33
56571d34d754
safe buffers, a memory leak and cleanups
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
25
diff
changeset
|
20 |
if ( $b && !($a =~ /mcbot/)) { |
56571d34d754
safe buffers, a memory leak and cleanups
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
25
diff
changeset
|
21 |
if($b =~ /^http/ ) { |
56571d34d754
safe buffers, a memory leak and cleanups
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
25
diff
changeset
|
22 |
print "$a - <a href=\"$b\">$b</a><br>"; |
56571d34d754
safe buffers, a memory leak and cleanups
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
25
diff
changeset
|
23 |
} else { |
56571d34d754
safe buffers, a memory leak and cleanups
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
25
diff
changeset
|
24 |
print "$a - $b<br>"; |
56571d34d754
safe buffers, a memory leak and cleanups
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
25
diff
changeset
|
25 |
} |
56571d34d754
safe buffers, a memory leak and cleanups
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
25
diff
changeset
|
26 |
} |
0 | 27 |
} |
28 |
||
29 |
print "\n<br>$a\n"; |
|
30 |
||
31 |
print "</body></html>\n"; |
|
32 |
close(FD); |