Morsulus Home Page | RecentChanges | Preferences

No diff available--this is the first major revision. (no other diffs)
This expects to be fed a list of file names. The files are the HTML file that holds all the items for a given person. It expects that the title tag in that file will be the name on the file.
use strict;
use warnings;

use Carp;
use IO::File;

print <<HEAD;
<TITLE>Consolidated Archive Listing</TITLE>
<BODY><H1>Consolidated Archive Listing</H1>

my %names;

while (<>)
	my $name = get_title($_);
	push @{$names{$name}}, "<a href = \"$_\">$name</a><br>\n";

foreach my $name (sort keys %names)
	print @{$names{$name}};

print <<TAIL;

sub get_title
	my $file = shift;
	my $fh = IO::File->new($file) or warn "Can't open '$file': $!";
	return $file unless $fh;
	my $contents;
		local $/;
		$contents = <$fh>;
	if ($contents =~ m:<title>(.+)</title>:i)
		return $1;
		return $file;

Morsulus Home Page | RecentChanges | Preferences
This page is read-only | View other revisions
Last edited March 23, 2008 10:47 pm by Herveus (diff)