/[wait]/cvs-head/lib/WAIT/Document/Ora.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /cvs-head/lib/WAIT/Document/Ora.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 73 by laperla, Mon Jan 28 21:35:39 2002 UTC revision 74 by laperla, Fri Mar 8 21:18:51 2002 UTC
# Line 28  sub TIEHASH { Line 28  sub TIEHASH {
28    
29    opendir(DIR, $dir) or croak "Could not open '$dir': $!";    opendir(DIR, $dir) or croak "Could not open '$dir': $!";
30   DIRENT: for my $entry (readdir DIR) {   DIRENT: for my $entry (readdir DIR) {
     # next unless $entry =~ /nt/;  
31      if (-f "$dir/$entry/desc.html") {      if (-f "$dir/$entry/desc.html") {
32        my $index = "$dir/$entry/index.html";        my $index = "$dir/$entry/index.html";
33        open F, $index or Carp::confess("Could not open $index: $!");        open F, $index or Carp::confess("Could not open $index: $!");
34        local $/;        local $/;
35        my $content = <F>;        my $content = <F>;
36        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;        next DIRENT unless $content =~ m|<div|s;
37        push @files, $entry;        push @files, $entry;
38      }      }
39    }    }
# Line 48  sub TIEHASH { Line 47  sub TIEHASH {
47    
48  sub FETCH {  sub FETCH {
49    my $self = shift;    my $self = shift;
50    my $file = shift;    my $id = shift;
51    
52    local($/) = undef;    local($/) = undef;
53    
   my $fh = IO::File->new(join('/',$self->{Dir},$file,'desc.html'));  
   my $desc = conv_getline($fh);  
   $fh = IO::File->new(join('/',$self->{Dir},$file,'author.html'));  
   my $author = conv_getline($fh) if $fh;  
   $fh = IO::File->new(join('/',$self->{Dir},$file,'index.html'));  
   my $index = conv_getline($fh) if $fh;  
   $fh = IO::File->new(join('/',$self->{Dir},$file,'colophon.html'));  
   my $colophon = conv_getline($fh) if $fh;  
54    return {    return {
55            desc => $desc,            desc => $self->conv_getline("$id/desc.html"),
56            author => $author,            author => $self->conv_getline("$id/author.html"),
57            index => $index,            index => $self->conv_getline("$id/index.html"),
58            colophon => $colophon,            colophon => $self->conv_getline("$id/colophon.html"),
59              translator => $self->conv_getline("$id/translator.html"),
60              toc => $self->conv_getline("$id/toc.html"),
61              inx => $self->conv_getline("$id/inx.html"),
62           };           };
63  }  }
64    
65  # WAIT::Document::Ora::conv_getline  # WAIT::Document::Ora::conv_getline
66  sub conv_getline ($) {  sub conv_getline {
67    my($fh) = shift;    my($self) = shift;
68      my($file) = shift;
69      my $fh = IO::File->new("$self->{Dir}/$file") or return "";
70    
71    local $/ = "\n";    local $/ = "\n";
72    my $firstline = <$fh>;    my $firstline = <$fh>;
73    my $src_enc;    my $src_enc;

Legend:
Removed from v.73  
changed lines
  Added in v.74

  ViewVC Help
Powered by ViewVC 1.1.26