26 |
my @files; |
my @files; |
27 |
|
|
28 |
opendir(DIR, $dir) or croak "Could not open '$dir': $!"; |
opendir(DIR, $dir) or croak "Could not open '$dir': $!"; |
29 |
for my $entry (readdir DIR) { |
DIRENT: for my $entry (readdir DIR) { |
30 |
if (-f "$dir/$entry/desc.html") { |
if (-f "$dir/$entry/desc.html") { |
31 |
|
my $index = "$dir/$entry/index.html"; |
32 |
|
open F, $index or Carp::confess("Could not open $index: $!"); |
33 |
|
local $/; |
34 |
|
my $content = <F>; |
35 |
|
next DIRENT unless $content =~ m|<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\s+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\s+<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">\s+<head>\s+<!-- product id:|s; |
36 |
push @files, $entry; |
push @files, $entry; |
37 |
} |
} |
38 |
} |
} |
39 |
|
closedir DIR; |
40 |
my $self = { |
my $self = { |
41 |
Dir => $dir, |
Dir => $dir, |
42 |
Files => \@files |
Files => \@files |
56 |
my $author = $fh->getline() if $fh; |
my $author = $fh->getline() if $fh; |
57 |
$fh = IO::File->new(join('/',$self->{Dir},$file,'index.html')); |
$fh = IO::File->new(join('/',$self->{Dir},$file,'index.html')); |
58 |
my $index = $fh->getline() if $fh; |
my $index = $fh->getline() if $fh; |
59 |
return { desc => $desc, author => $author, index => $index}; |
$fh = IO::File->new(join('/',$self->{Dir},$file,'colophon.html')); |
60 |
|
my $colophon = $fh->getline() if $fh; |
61 |
|
return { |
62 |
|
desc => $desc, |
63 |
|
author => $author, |
64 |
|
index => $index, |
65 |
|
colophon => $colophon, |
66 |
|
}; |
67 |
} |
} |
68 |
|
|
69 |
sub FIRSTKEY { |
sub FIRSTKEY { |