#!/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#.+? by (.+?) 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 Name Space node on Perlmonks. 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 $nr nodes are indexed."),
p('Blessings on your houses,
George'),
'',
"\n",
h2('Index:');
for (0..$col) {
print FH "<A HREF=\"http://www.perlmonks.net?node_id=$names{$names$_}\" TARGET=\"NameSpace\">$names$_ \n";
if (lc(substr($names$_,0,1)) ne lc(substr($names$_+1,0,1))) {
print FH " \n";
}
}
print FH ' | ';
for ($col..(2*$col)) {
print FH "<A HREF=\"http://www.perlmonks.net?node_id=$names{$names$_}\" TARGET=\"NameSpace\">$names$_ \n";
if (lc(substr($names$_,0,1)) ne lc(substr($names$_+1,0,1))) {
print FH " \n";
}
}
print FH ' | ';
for ((2*$col)..$#names) {
print FH "<A HREF=\"http://www.perlmonks.net?node_id=$names{$names$_}\" TARGET=\"NameSpace\">$names$_ \n";
if (defined $names$_+1 and lc(substr($names$_,0,1)) ne lc(substr($names$_+1,0,1))) {
print FH " \n";
}
}
print FH
' | ',
"\n",
end_html;
|
|