/usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 92. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 95. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 99. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 103. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 107. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 110. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 114. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 117. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 121. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 123. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 127. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 129. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 133. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 138. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 142. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 146. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 150. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 154. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 158. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 164. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 168. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 170. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 174. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 176. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 180. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 182. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 186. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 208. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 212. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 224. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 228. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 245. ignoring. Gff - Perl Module to modify Gff datastructures in memory

NAME

Gff - Perl Module to modify Gff datastructures in memory


ABSTRACT

This module includes functions to read, and modify gff objects. The objects are represented as hash table having other hash tables, arrays or values inside of it. The basic use is like multilevel hash tables: $$gff{'key'}[0]{'Text'}{0}.


DESCRIPTION

You first need either to greate new Gff with Gff::new or read gff structure from disk using GffRead::read. Then you can modify the gff structure in memory with functions defined here (or simply reading values from hash table or assigning new values to them). When you are done you can write gff back to disk using GffWrite::write.


Gff::new

Gff::new is used to bless any other hash to be Gff hash or just to return new empty Gff hash.

USAGE

\%gff = Gff->new();

\%gff = Gff->new(\%hash);


Gff::get_or_set

Gff::get_or_set is used either get old value of the field, or to set new value for the field. The field can be given as a path through the gff structure.

USAGE

$value = $gff->get_or_set($field);

$value = $gff->get_or_set($field, $value);

The $field can be in the path format, meaning it can have structure names separated by slashes, and array names followed by index of the item in brackets. I.e. format like ``/Creature List[0]/ClassList[0]/MemorizedList8[1]/SpellMetaMagic'' or ``/AreaProperties/MusicDelay''. The returned value will be blessed as Gff structure if it is structure or array. Normally you do not use this low level function, but those upper level functions like Gff::value.


Gff::file_type

Gff::file_type is used either to set or get file type. This function can only be called on the top level gff structure.

USAGE

$file_type = $gff->file_type();

$file_type = $gff->file_type($file_type);


Gff::file_version

Gff::file_version is used either to set or get file version number. This function can only be called on the top level gff structure.

USAGE

$file_version = $gff->file_version();

$file_version = $gff->file_version($file_version);


Gff::copy_to_top

Gff::copy_to_top can be used to take a copy of the gff so that the new returned Gff structure is on the top level, i.e. suitable for GffWrite::write. The returned Gff and the old Gff do share the lower level data structures, so modifying them will modify both of them.

USAGE

$new_top_gff = $gff->copy_to_top($file_type, $file_version);


Gff::struct_keys

Gff::struct_keys returns a list of keys on the given structure level.

USAGE

@keys = $gff->struct_keys();


Gff::value

Gff::value is used either get old value of the field, or to set new value for the field. The field can be given as a path through the gff structure. This can also be used to set the type of the field.

USAGE

$gff_or_value = $gff->value($field);

$gff_or_value = $gff->value($field, $value);

$gff_or_value = $gff->value($field, $value, $type);

The $field can be in the path format, meaning it can have structure names separated by slashes, and array names followed by index of the item in brackets. I.e. format like ``/Creature List[0]/ClassList[0]/MemorizedList8[1]/SpellMetaMagic'' or ``/AreaProperties/MusicDelay''. The returned value will be blessed as Gff structure if it is structure or array. Normally you do not use this low level function, but those upper level functions like Gff::value. If $type is given then it must be a number matching the nwn type numbers.


Gff::type

Gff::type returns or sets the type of the field.

USAGE

$type = $gff->type();

$type = $gff->type($type);

The $type is nwn internal type number.


Gff::language

Gff::language converts language id or name and optional gender to language code to be used as index in the localized strings.

USAGE

$code = $Gff::language($lang, $gender);

$code = $Gff::language($lang);

The $code is number, and $lang is either language number or name ('English', 'French' etc). $gender is either number 0 (= male), or 1 (= female) or string 'Male', or 'Female'. All strings are case insensetive.


Gff::variable

Gff::variable is used mostly to set local variables on the structures. It can also be used to fetch the internal gff structure of the variable so the name, value and type can be fetched from there. Those values match the GetLocalString/GetLocalInt etc and SetLocalString/SetLocalInt functions of the nwn-script.

USAGE

$gff = $gff->variable($name);

$gff = $gff->variable($name, $value);

$gff = $gff->variable($name, $value, $type);

If value is given but undef, then variable is removed. If no type is given then the type is guessed based by the value. If value consists only numbers, then it is assumed to be integers, if value matches \d.\d regexp then it is assumed to be float, and string otherwise. If the type is given it can either be numeric variable type code (different than gff type codes), or 'int', 'float', 'string', 'object', or 'location'. In case 'object' and 'location' then the internal format of the value must be properly formatted for that type. This always return the internal gff structure of the variable.

To get the variable value, type or name use $gff->variable($name)->varvalue, $gff->variable($name)->vartype, and $gff->variable($name)->varname.


Gff::varname

Gff::varname is used to get the name of the variable.

USAGE

$name = $gff->varname();


Gff::varvalue

Gff::varvalue is used to get the value of the variable.

USAGE

$value = $gff->varvalue();


Gff::vartype

Gff::vartype is used to get the type of the variable.

USAGE

$name = $gff->vartype();


Gff::print

Gff::print is used to print the Gff structure to the stdout.

USAGE

$gff->print(%options);

OPTIONS

Following options can be given to the Gff::print.

prefix => prefix
Prefix to be added before each line.

print_types => boolean
Whether to print types and other information too.

print_code => boolean
Whether to print structure as perl code.

no_labels => boolean
Whether to print labels.

separator => string
String to separating label and value. Default value is ``:\t''.

skip_matching_label => regexp
Skip labels matching given regexp.

skip_matching_value => regexp
Skip values matching given regexp.

dialog => Tlk::dialog
Tlk object returned by TlkRead::read. If this is given then string_refs are also converted to strings.


Gff::encode

Gff::encode is used to encode the Gff structure as array of arrays, i.e it is array of all entries in the gff (as flat array), and each array entry has two items, first is the key and second is the value.

USAGE

@@result = $gff->encode(%options);

OPTIONS

Following options can be given to the Gff::encode.

types => boolean
Whether to include type and other information too.

skip_matching_label => regexp
Skip labels matching given regexp.

skip_matching_value => regexp
Skip values matching given regexp.


Gff::find

Gff::find is used to find parts of the Gff structure and call given function for each instance of those structures matching.

USAGE

$gff->find(%options);

OPTIONS

Following options can be given to the Gff::find.

find_label => regexp
Find lables having value matching regexp, if not set then do not check labels. This is matched against the full label name, i.e. full path included, including array indexes.

If multiple of find_label, find_field and find_type are set, then all of them are checked, and proc is only called if all match.

find_field => regexp
Find fields having value matching regexp, if not set then do not check fields. This is only checked against scalar values.

If multiple of find_label, find_field and find_type are set, then all of them are checked, and proc is only called if all match.

find_type => hash
Find fields having type defined in the hash table, if not set then do not check types. This is only checked against scalar values.

If multiple of find_label, find_field and find_type are set, then all of them are checked, and proc is only called if all match.

proc => proc($gff, $full_label, $label, $value, \@parent_gffs);
Perl procedure to call if field is found. The $gff is parent node of the field. $full_label is the full label including all array indexes and so on, the $label is the field label, and $value is the value. The \@parent_gffs is a list of parent gffs, starting from the top and going towards the structure found.


Gff::match

Gff::match is used to match two or more Gff structures, and return first difference between them. In case structures match undef is returned. If more than two structures are given, then all other structures are/usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 249. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 252. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unterminated list at =head in paragraph 256. ignoring. /usr/pkg/bin/pod2html: perllib/Gff.pm: unexpected =back directive in paragraph 259. ignoring. matched against the first one.

USAGE

$difference = match($gff1, $gff2, ...);

$difference = $gff1->match($gff2, ...);


Gff::diff

Gff::diff is used to get difference two or more Gff structures, and return all differences between them. In case structures match undef is returned. If more than two structures are given, then all other structures are matched against the first one, and an array of strings is returned, one for each structure after first one.

USAGE

$difference = diff($gff1, $gff2, ...);

$difference = $gff1->diff($gff2, ...);


SEE ALSO

gffprint(1), gffmodify(1), GffRead(3), and GffWrite(3).


AUTHOR

Tero Kivinen <kivinen@iki.fi>.


HISTORY

Created to do automated things for the cerea persistent world.