Daniel Ruoso > Oak-Filer-XML > Oak::Filer::XML

Download:
Oak-Filer-XML-1.8.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Source  

NAME ^

Oak::Filer::XML - Saves/retrieves data to/from a XML file

DESCRIPTION ^

This module saves and retrieves properties using a XML file. the file has the format:

  <!ELEMENT main (prop+)>
  <!ATTLIST prop
  name CDATA #REQUIRED
  value CDATA #REQUIRED>

An example of the XML file is:

  <main>
    <prop name="filename" value="/tmp/example123"/>
  </main>

HIERARCHY ^

Oak::Object

Oak::Filer

Oak::Filer::XML

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

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.

store(NAME=>VALUE)

Save the properties and the values

load(NAME,NAME,...)

Loads the data and returns its value

EXAMPLES ^

  # To create the default filer
  require Oak::Filer::XML;
  my $filer = new Oak::Filer::XML(type => 'file', FILENAME => 'config.xml');
  $filer->store(NAME=>VALUE);
  my %props = $filer->load(NAME);

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.