NAME
Oak::Filer::XML - Saves/retrieves data to/from a XML file
DESCRIPTION
This module saves and retrieves a structure from a XML file.
PROPERTIES
- TYPE
-
file or fh, defines if it will open a file or just use a filehandle
- FILENAME
-
if type equals file, then this file will be opened
- FILEHANDLE
-
if type equals fh, then this fh will be used
- HANDLER
-
Defines a package that contain the parse methods defined by XML::Parser
METHODS
- constructor
-
Overrided to receive the following parameters:
FILENAME => filename of the XML file FH => filehandle of the XML file
You must pass one (and just one) of these parameters. In the case you miss this will be throwed an Oak::Error::ParamsMissing error.
There is another mandatory parameter, which is
HANDLER => Your::Custom::XML::Handler
The class must follow the specification of XML::Parser, if you dont understand what it means, please read its documentation
- store(NAME=>VALUE)
-
Saves the data into the XML file. Be carefull to set properties only at the first level of the hash. If you have to set a property that is in a deep level, please save the root of the hash. This module do not create any cache. Every time you store a key of the hash it will read the XML file.
- remove(NAME)
-
This function will delete this key from the hash and store. As the store function, it will retrieve the hash from the XML file again.
EXAMPLES
# To create the default filer
require Oak::Filer::XML;
my $filer = new Oak::Filer::XML;
$filer->store(NAME=>VALUE);
my %props = $filer->load(NAME);
RESTRICTIONS
This is a skeleton class. It does not work. Actually I did not need it yet :)
COPYRIGHT
Copyright (c) 2001 Daniel Ruoso <daniel@ruoso.com>. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.