]>
code.delx.au - gnu-emacs-elpa/blob - packages/notes-mode/NotesIndex.pm
5 # $Id: NotesIndex.pm,v 1.3 2003/05/23 16:26:19 johnh Exp $
7 # Copyright (C) 1996 by John Heidemann.
8 # Comments to <johnh@isi.edu>.
10 # This file is under the Gnu Public License, version 2.
11 # For details see the COPYING which accompanies this distribution.
15 # A Perl module implement a notes-index class.
23 $Notes::revsion
= '$Id: NotesIndex.pm,v 1.3 2003/05/23 16:26:19 johnh Exp $';
24 $Notes::VERSION
= 1.00;
28 NotesIndex - a simple class for notes-index files
32 new, read_from_file, subjects, by_subject, prelude
37 #----------------------------------------------------------------------
42 my ($class, $file) = @_;
44 if (!defined($file)) {
47 $self->read_from_file($file);
55 my ($self, $filename) = @_;
59 open(FILE
, "<$filename") || croak
"Cannot open $filename";
73 return keys %{$self->{'links_by_subject'}};
78 my($self, $subject) = @_;
79 $subject = lc($subject);
80 my($resref) = $self->{'links_by_subject'}{$subject};
81 return wantarray ?
() : undef
82 if (!defined($resref));
83 return wantarray ? @
$resref : 1;
89 my($self, $link) = @_;
90 my($subject) = ($link =~ m/\d{2}\#\* (.*)$/);
91 $subject = lc($subject);
92 push (@
{ $self->{'links_by_subject'}{$subject} }, $link);