NAME
Biblio::Catalog::Simple - Perl extension for managing XML catalog files
SYNOPSIS
use Biblio::Catalog::Simple;
$catalog = catalogNew("catalogue.xml","ISO-8859-1");
$catalog = catalogLoad("catalogue.xml");
$catalog -> catalogAdd("2","<title>Me</title>");
$catalog -> catalogSave();
$catalog -> catalogId(4); # will return "<title>They</title>"
# these two functions handle multi-language support
@languages = catalogLanguages();
catalogSetLanguage('pt');
DESCRIPTION
This module aims to help people who needs to manage a XML catalog. So, each record is identified by a number-id. The record contents should be correct XML accordingly with some DTD.
catalogLanguages
This function returns a list of the valid languages in the current version.
catalogSetLanguage
You must supply a valid language code (from the list returned by catalogLanguages) to change the language used in the forms and in the interactive shell. By default, it is used portuguese.
catalogNew
This function is an Catalog Object Constructor. Given a file name it creates an empty catalog and returns the correspondent object.
If the second argument is present, it is used as a encoding reference. So, if you use catalogNew("c.xml","ISO-8859-1")
command, the file c.xml
will be created with the following contents:
<?xml version="1.0" encoding="ISO-8859-1"?>
<catalog>
</catalog>
catalogLoad
This is another Catalog Object Constructor. Really, it's an Object Re-Constructor as it loads a saved Catalog Object. It receives, as argument the catalog file name.
catalogAdd
A method to add a record to the catalog. The following arguments are the record id and the record contents. The record contents should be valid XML. Meanwhile, there is no need for a root tag, but it can exists. This XML is not checked, so, be sure it is valid XML. This method returns the record id.
NOTE: the data is cached but not saved to the file. To have sure it is, really, saved, call the catalogSave method. If the id already exists, the contents will be replaced
catalogSave
This method syncs the catalog to disk. Use this everytime you make a big amount of changes on the catalog.
catalogId
Given an identifier, this method returns the corresponding value or undef if it does not exists.
AUTHOR
Alberto M. B. Simões <albie@alfarrabio.di.uminho.pt>
SEE ALSO
Manpages CGI(3) and perl(1).
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 283:
Non-ASCII character seen before =encoding in 'Simões'. Assuming CP1252