Help-Site Computer Manuals
Software
Hardware
Programming
Networking
  Algorithms & Data Structures   Programming Languages   Revision Control
  Protocols
  Cameras   Computers   Displays   Keyboards & Mice   Motherboards   Networking   Printers & Scanners   Storage
  Windows   Linux & Unix   Mac

Meta.pm

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


NAME

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


 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

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

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



=head2 set($param,$value)

Sets the value for a meta information attribute.

errmsg()


SEE ALSO

Alvis::Document, Alvis::Convert


AUTHOR

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


COPYRIGHT AND LICENSE

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.




=cut





Programminig
Wy
Wy
yW
Wy
Programming
Wy
Wy
Wy
Wy