
Alvis::Document::Meta - Perl extension for representing meta information about a document, such as its URL, title, modification date, HTML header information, detected character set,...
Maps HTML header attributes to the Dublin Core set (dc:title etc.).

use Alvis::Document::Meta;
# Two ways of creating an instance
# Create a new instance from e.g. a file containing the meta information
my $m=Alvis::Document::Meta->new();
if (!defined($m))
{
die('Ugh!');
}
my $meta_txt=&read_meta_file($file);
if (!$m->parse($meta_txt))
{
die('Parsing the meta file failed.' . $m->errmsg());
}
# or by directly supplying the text at instantiation time
my $m=Alvis::Document::Meta->new(text=>$meta_txt);
if (!defined($m))
{
die('Ugh!');
}
# If you wish to get the list of DC fields
for my $dc_attr ($m->get_dcs())
{
my ($attr,$value)=@$dc_attr;
# do something
}
# There are additional special attributes you can set and get like this
$m->set('url','foo.html');
my $date=$$m->get('date');

See the source for the exact mapping from HTML header fields to DC. Syntax of the meta information file:
<feature name>\t<feature value>\n
"Special" field names are url title date detected-charset

Options:
text The text of a meta information file.
Maps the features to the Dublin Core set (dc:title etc.).
"Special" field names are url title date detected-charset
Returns all Dublin Core mapped features as ([<name>,<value>],[<name>,<value>],...)
Returns the setting for the attribute. "Special" parameters are
url
title
date
detectedCharSet
Sets the value for a meta information attribute.

Alvis::Document, Alvis::Convert

Kimmo Valtonen, <kimmo.valtonen@hiit.fi>

Copyright (C) 2006 by Kimmo Valtonen
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.