/[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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 57 - (hide annotations)
Fri Jan 4 14:50:26 2002 UTC (22 years, 4 months ago) by ulpfr
File size: 1576 byte(s)
Ignore missing author.html

1 ulpfr 53 # -*- Mode: Cperl -*-
2     # Nroff.pm --
3     # ITIID : $ITI$ $Header $__Header$
4     # Author : Ulrich Pfeifer
5     # Created On : Mon Sep 16 19:04:37 1996
6     # Last Modified By: Ulrich Pfeifer
7 ulpfr 57 # Last Modified On: Fri Jan 4 15:45:35 2002
8 ulpfr 53 # Language : CPerl
9 ulpfr 57 # Update Count : 85
10 ulpfr 53 # Status : Unknown, Use with caution!
11     #
12     # Copyright (c) 1996-1997, Ulrich Pfeifer
13     #
14    
15     package WAIT::Document::Ora;
16     @ISA = qw(WAIT::Document::Base);
17     require WAIT::Document::Base;
18    
19     use IO::File;
20     use strict;
21     use Carp;
22    
23     sub TIEHASH {
24     my $type = shift;
25     my $dir = shift;
26     my @files;
27    
28     opendir(DIR, $dir) or croak "Could not open '$dir': $!";
29     for my $entry (readdir DIR) {
30     if (-f "$dir/$entry/desc.html") {
31     push @files, $entry;
32     }
33     }
34     my $self = {
35     Dir => $dir,
36     Files => \@files
37     };
38     bless $self, ref($type) || $type;
39     }
40    
41     sub FETCH {
42     my $self = shift;
43     my $file = shift;
44    
45     local($/) = undef;
46    
47     my $fh = IO::File->new(join('/',$self->{Dir},$file,'desc.html'));
48     my $desc = $fh->getline();
49     $fh = IO::File->new(join('/',$self->{Dir},$file,'author.html'));
50 ulpfr 57 my $author = $fh->getline() if $fh;
51 ulpfr 53 return { desc => $desc, author => $author};
52     }
53    
54     sub FIRSTKEY {
55     my $self = shift;
56     $self->{fno} = 0;
57     $self->NEXTKEY;
58     }
59    
60     sub NEXTKEY {
61     my $self = shift;
62     return undef if ($self->{fno}++ > @{$self->{Files}});
63     $self->{Files}->[$self->{fno}-1];
64     }
65    
66     sub close {
67     my $self = shift;
68    
69     delete $self->{fno};
70     delete $self->{Files}; # no need at query time
71     }
72    
73     1;

Properties

Name Value
cvs2svn:cvs-rev 1.2

  ViewVC Help
Powered by ViewVC 1.1.26