Alvis::Document::Meta - Perl extension for representing meta information


Alvis-Convert documentation  | view source Contained in the Alvis-Convert distribution.

Index


NAME

Top

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.).

SYNOPSIS

Top

 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');

DESCRIPTION

Top

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

METHODS

Top

new()

Options:

    text    The text of a meta information file.

parse($meta)

Maps the features to the Dublin Core set (dc:title etc.).

"Special" field names are url title date detected-charset

get_dcs()

Returns all Dublin Core mapped features as ([<name>,<value>],[<name>,<value>],...)

get($param)

Returns the setting for the attribute. "Special" parameters are

      url   
      title
      date
      detectedCharSet 




set($param,$value)

Sets the value for a meta information attribute.

errmsg()

SEE ALSO

Top

Alvis::Document, Alvis::Convert

AUTHOR

Top

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

COPYRIGHT AND LICENSE

Top


Alvis-Convert documentation  | view source Contained in the Alvis-Convert distribution.