Metadata::IAFA - IAFA Template metadata class
use Metadata::IAFA
...
$i=new Metadata::IAFA;
$i->set('element1', [qw(v1 v2 v3)]);
$i->set('element2', 'v2');
my $val=$i->get('element2);
for my $v ($i->get('element1') {
...
}
...
The Metadata::IAFA class supports IAFA Templates metadata using the
Metadata::Base class and customises it for IAFA Templates where element names
have variants to represent to sub-values.
- new [OPTIONS]
- An optional hash of options can be given to the constructor to set various
options. There are currently three Metadata::IAFA options
defined:
- STRICT
- This is defined to turn on strict interpretation of the draft IAFA
Templates standard. See the read method for what this implies.
- TEMPLATE_TYPE
- Set the template type for this IAFA Template (default is DOCUMENT). The
alternate ways to set this are via the template_type or set
methods.
- DEBUG
- This class has a separate debug class / object method that works in
the same fashion as the Metadata::Base method debug. Setting
it here also sets the debugging on the base Metadata::Base object
too.
- WRAP
- When formatting the metadata for output, word wrap the results so that
they fit into 80-columns. This is done using the Text::Wrap
class.
The methods here describe the differences from the Metadata::Base class methods.
- set ELEMENT, VALUE, [INDEX]
- get ELEMENT, [INDEX]
- exists ELEMENT, [INDEX]
- These methods work in the same way as the Metadata::Base::set
methods except that ELEMENT can contain the variant if it is
of the form: ELEMENT-INDEX where INDEX is a decimal
number.
- template_type [TEMPLATE-TYPE]
- The Template-Type of the metadata can be set by the set method but
it is stored separately from the regular elements and can only be
retrieved from using this method when it is called with no arguments.
- read HANDLE
- Implements reading a single IAFA Template from the given HANDLE.
This is done in a generous style (different from the draft standard),
rather than ending the template on a blank line, uses empty lines and thus
allows element values to contain multiple paragraphs separated by entirely
white space lines.
- format
- Returns a formatted version of the IAFA Template suitable for writing to a
file (and reading in with the read method).
- get_date_as_seconds ELEMENT
- This handles the strict IAFA format as well as a format of YYYY-MM-DD and
a raw decimal number-of-seconds.
- decode_uri_element VALUE
- Return a list of three elements from decoding the VALUE as a URI
element: the base file name, the full path and the destination path (if a
symlink). If the URI is just a plain URI, the full path will be
empty.
- encode_uri_element URI =item encode_uri_element FILE, PATH
- Return an encoding for either a URI or a local FILE and its
remote PATH (symlink).
- order_template_type TEMPLATE-TYPE
- Return an ordering of the TEMPLATE-TYPE suitable for
sort.
Metadata::Base, Text::Wrap
By Dave Beckett - http://purl.org/net/dajobe/
Copyright (C) 1997-2001 Dave Beckett - http://purl.org/net/dajobe/ All rights
reserved.
Hey! The above document had some coding errors, which are explained
below:
- Around line 370:
- You forgot a '=back' before '=head1'
- Around line 428:
- =back doesn't take any parameters, but you said =back 4