source: main/tags/2.00/gsdl/perllib/colcfg.pm@ 24239

Last change on this file since 24239 was 537, checked in by sjboddie, 25 years ago

added GPL headers

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1###########################################################################
2#
3# colcfg.pm --
4# A component of the Greenstone digital library software
5# from the New Zealand Digital Library Project at the
6# University of Waikato, New Zealand.
7#
8# Copyright (C) 1999 New Zealand Digital Library Project
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23#
24###########################################################################
25
26# reads in a collection configuration file
27
28package colcfg;
29
30use cfgread;
31
32
33# the collection configuration file data is stored in the form
34#
35# {'creator'}->string
36# {'maintainer'}->array of strings
37# {'public'}->string
38# {'beta'}->string
39# {'key'}->string
40# {'languages'}->array of strings
41# {'subcollection'}->hash of key-value pairs
42# {'indexsubcollections'}->array of strings
43# {'indexes'}->array of strings
44# {'defaultindex'}->string
45# {'plugins'}->array of strings
46
47sub read_collect_cfg {
48 my ($filename) = @_;
49
50 return &cfgread::read_cfg_file ($filename,
51 '^(creator|public|beta|key|defaultindex|importdir|' .
52 'archivedir|cachedir|builddir|textindex|removeold)$',
53 '^(maintainer|languages|indexsubcollections|indexes|plugins|dontbuild)$',
54 '^(subcollection|collectionmeta)$');
55}
56
57sub write_collect_cfg {
58 my ($filename, $data) = @_;
59
60 &cfgread::write_cfg_file($filename, $data,
61 '^(creator|public|beta|key|defaultindex|importdir|' .
62 'archivedir|cachedir|builddir|textindex|removeold)$',
63 '^(maintainer|languages|indexsubcollections|indexes|plugins|dontbuild)$',
64 '^(subcollection|collectionmeta)$');
65}
66
67
68# the build configuration file data is stored in the form
69#
70# {'builddate'}->string
71# {'metadata'}->array of strings
72# {'languages'}->array of strings
73# {'numdocs'}->string
74# {'numwords'}->string
75# {'numbytes'}->string
76
77sub read_build_cfg {
78 my ($filename) = @_;
79
80 return &cfgread::read_cfg_file ($filename,
81 '^(builddate|numdocs|numwords|numbytes)$',
82 '^(metadata|languages)$');
83}
84
85sub write_build_cfg {
86 my ($filename, $data) = @_;
87
88 &cfgread::write_cfg_file($filename, $data,
89 '^(builddate|numdocs|numwords|numbytes)$',
90 '^(metadata|languages)$');
91}
92
93
941;
Note: See TracBrowser for help on using the repository browser.