in reply to Inconsistency of navigation links
In short, a consistant category label would have made this project *much* easier, and would improve its robustness in the future.
Update: Although it's quite ugly, here is the relevant snippet.
my $html = get("http://perlmonks.com/index.pl?op=randomnode"); ($node) = $html =~ /\blastnode_id=(\d+)/; my ($title) = $html =~ /<title>([^>]+)<\/title>/i; my ($author) = $html =~ /\bby\s*<A HREF[^>]+>([^<]+)<\/A>/i; if ($title eq $author) { $section = 'Homenode'; ($homenodexp) = $html =~ /Experience:.*?<B>(\d+)/; } elsif ($author eq 'perlnewsbot') { $section = 'News'; } else { ($section) = $html =~ /\b(?:go|back)\s+(?:to\s+)?(?:see\s+more\s+) +?<A HREF=\ "\/index.pl\?node=(Seekers|Meditations|Craft|Cool|Perl)/i; $section = 'Poetry' if $section eq 'Perl'; $section ||= $html =~ /bgcolor="CCCCCC"/i ? 'Code' : ''; $section ||= 'Disc'; }
-Blake
|
|---|