The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

ROADS::ReadTemplate - A class to read in templates

SYNOPSIS

  use ROADS::ReadTemplate;
  %ALLTEMPS = readalltemps();
  # readtemplate should call readalltemps if necessary
  %MYTEMP = readtemplate("XDOM01");
  print $MYTEMP{title}, "\n";

DESCRIPTION

This class implements two methods associated with reading in IAFA templates and template handle to filename mappings.

METHODS

%ALLTEMPS = realalltemps();

The readalltemps method reads in the list of template handles and the filenames in which they can be found from the alltemps file, usually found in the ROADS guts directory.

%MYTEMP = readtemplate( handle );

The readtemplate method tries to read in the template with the handle handle, and returns it as a hash array. The hash array has the template's attributes as its keys, and the attributes' values as its values.

The realalltemps method will be used to discover the filename corresponding to the template handle, unless the ALLTEMPS variable has been set already. Filenames with relative paths are assumed to be in the ROADS source directory.

%MYTEMP = readtemplate( handle, filename );

An alternative invocation of readtemplate, this allows the programmer to specify the filename which the template should be loaded from.

FILES

guts/alltemps - list of template handle to filename mappings.

source - actual templates themselves

FILE FORMAT

The alltemps file is line structured, with a separate template's entry on each line. The fields are :-

handle

The handle of the template

filename

The filename of the template

BUGS

We tend to assume that the template handle and the filename will be the same. This will have to change when we move to a hierarchical source directory structure - which we'll have to do in order to scale ROADS to large numbers of records ?

SEE ALSO

"addsl.pl" in bin, "addwn.pl" in bin, "cullsl.pl" in bin, "deindex.pl" in bin, "rebuild.pl" in bin, "suggest.pl" in cgi-bin, "search.pl" in cgi-bin, "admin.pl" in admin-cgi, "mktemp.pl" in admin-cgi

COPYRIGHT

Copyright (c) 1988, Martin Hamilton <martinh@gnu.org> and Jon Knight <jon@net.lut.ac.uk>. All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

It was developed by the Department of Computer Studies at Loughborough University of Technology, as part of the ROADS project. ROADS is funded under the UK Electronic Libraries Programme (eLib), the European Commission Telematics for Research Programme, and the TERENA development programme.

AUTHOR

Jon Knight <jon@net.lut.ac.uk>