scratchpad
George_Sherston
#!/usr/bin/perl -w
use strict;
use lib '/home/httpd/lib';
use CGI qw/:standard :cgi-lib/;
use LWP::Simple;
my $text = get 'http://www.perlmonks.net/index.pl?node_id=110166';
my %names = (George_Sherston => 110166);
while ($text =~ s#<a HREF="/index\.pl\?node_id=(\d+)">.+?</a><BR> by <a HREF="/index\.pl\?node_id=(\d+)">(.+?)</a> on \w{3} \d{1,2}, \d{4} at# #) {
unless (defined $names{$3}) {
$names{$3} = $1;
}
}
my @names = sort {lc $a cmp lc $b} keys %names;
my $nr = scalar @names;
my $col = int($nr/3);
open FH, ">index.html";
print FH
start_html('Perlmonks Name Space Index'),
h2('Name Space Index'),
p('This page is an index for the <A HREF="http://www.perlmonks.net/index.pl?node_id=110166">Name Space</A> node on <A HREF="http://www.perlmonks.net">Perlmonks</A>. It updates daily. The link opens in a new window.'),
p("This page has no rocket science - it just indexes the first node added to the thread by a given monk. If you didn\'t put your etymology on your first sub node then may I encourage you to edit the sub node? So far <B>$nr</B> nodes are indexed."),
p('Blessings on your houses,<BR><BR><A HREF="http://www.perlmonks.net/index.pl?node_id=103111">George</A>'),
'<TABLE BORDER="0" WIDTH="100%"><TR VALIGN="TOP"><TD WIDTH="33%">',
"\n",
h2('Index:');
for (0..$col) {
print FH "<A HREF=\"http://www.perlmonks.net?node_id=$names{$names[$_]}\" TARGET=\"NameSpace\">$names[$_]</A><BR>\n";
if (lc(substr($names[$_],0,1)) ne lc(substr($names[$_+1],0,1))) {
print FH "<BR>\n";
}
}
print FH '</TD><TD WIDTH="33%">';
for ($col..(2*$col)) {
print FH "<A HREF=\"http://www.perlmonks.net?node_id=$names{$names[$_]}\" TARGET=\"NameSpace\">$names[$_]</A><BR>\n";
if (lc(substr($names[$_],0,1)) ne lc(substr($names[$_+1],0,1))) {
print FH "<BR>\n";
}
}
print FH '</TD><TD WIDTH="34%">';
for ((2*$col)..$#names) {
print FH "<A HREF=\"http://www.perlmonks.net?node_id=$names{$names[$_]}\" TARGET=\"NameSpace\">$names[$_]</A><BR>\n";
if (defined $names[$_+1] and lc(substr($names[$_],0,1)) ne lc(substr($names[$_+1],0,1))) {
print FH "<BR>\n";
}
}
print FH
'</TD></TR></TABLE>',
"\n",
end_html;