NAME

Meta::Info - Encapsulation of Imperia document meta information


SYNOPSIS

use Meta::Info;

my $meta = Meta::Info->new ({ keywords => [ 'Movies',
'Action' ],
template => [ '911dvd' ] });

my $keywords = $meta->getValues ('keywords');

$meta->setValues (keywords => 'TV');

$meta->setValues (keywords => ['TV', 'Soap']);

$meta->setValues (keywords => ('TV', 'Soap'));

$meta->pushValues (keywords => 'Daily');

$meta->pushValues (keywords => ['Daily', 'Boring']);

$meta->pushValues (keywords => ('Daily', 'Boring'));

my $meta_keys = $meta->keys;

my $dump = $meta->dump;


DESCRIPTION

The Meta::Info class encapsulates all operations on Imperia document meta information.


CONSTRUCTORS

new METAHASH
Create a new instance of the class. The METAHASH must be a reference to a hash made up of key value pairs where the keys are the names of the meta fields and the values are references to a list of scalar values.

fromCGI CGIFORM
Creates a new instance of the class from a reference to a CGI form hash as returned by DecodeFormData() defined in site_form_lib(3).

clone METAINFO
Copy constructor that creates a deep copy of the METAINFO argument.


PUBLIC METHODS

getValues KEY
Retrieves the corresponding values of meta field KEY or undef if there is no meta information stored under that key.

In scalar context only the first value is returned which might come in handy if you are certain that there is only one associated value present. In array context the complete list of associated values is returned.

dirty
Returns true if the object is dirty, i. e. its content has changed since creation.

dirty FLAG
Sets resp. resets the object dirty state according to the boolean attribute FLAG.

setValues KEY, VALUE[, VALUES]
This method can be used in various ways to set the meta information that should be stored under KEY. If more than one value is passed to the function (i. e. VALUES is defined and is either a list or a scalar) all values are stored in the object. If VALUE is a reference it is treated as an array reference, dereferenced and the retrieved values get stored. If VALUE is a scalar it will be stored as the sole value for KEY.

As the name already suggests the method will clobber any existing meta information stored under KEY

Will make the object dirty if the new content for KEY differs from the old content.

pushValues KEY, VALUE[, VALUES]
Same as setValues but the new values are appended to existing meta information. Note that you can safely call this method even if there is nothing stored under KEY.

deleteValues KEY
Removes all values associated with the specified KEY.

In array context, returns an array of all deleted values. In scalar context, returns the first deleted value.

Will make the object dirty unless there has been no data associated with KEY.

searchKey KEY, REG
Returns true if the corresponding values of meta the field KEY matches the regular expression REG

searchAll REG
Returns true if the any meta-field matches the regular expression REG. Internal fields (i.e. fields whose name starts with __imperia) won't be examined.


INHERITANCE

None.


COPYRIGHT


Copyright 2001, 2002, Imperia AG.
All rights reserved.


AUTHOR

Guido Flohr (guido@imperia.net)


SEE ALSO

site_form_lib(3), perl(1)