NAME

Treex::Core::WildAttr - role for arbitrary attributes of Treex objects

VERSION

version 1.20150902

  $node->wild->{name_of_my_new_attribute} = $value;
  $value = $node->wild->{name_of_my_new_attribute};

DESCRIPTION

Moose role for Treex objects that can possess any attributes without defining them in the PML schema. Such 'wild' attributes are stored in trees data files as strings serialized by Data::Dumper.

Expected use cases: you need to store some data structures which are not defined by the Treex PML schema because (1) you do not want to change the schema (e.g. the new attributes are still very unstable, or they are likely to serve only for tentative purposes, or you do not feel competent to touch the PML schema), or (2) you cannot change the schema, because you do not have write permissions for the location in which Treex::Core is installed.

ATTRIBUTES

wild

Reference to a hash for storing wild attributes. The attributes are to be accessed as follows:

 $object->wild->{$wild_attr_name} = $wild_attr_value;
wild_dump

PML-standard attribute which stores stringified content of the attribute wild. wild and wild_dump are synchronized by methods serialize_wild and deserialize_wild; wild_dump should not be accessed otherwise.

METHODS

serialize_wild();

Stores the content of the wild hash into the wild_dump string.

deserialize_wild();

Loads the content from the wild_dump string into the wild hash.

AUTHOR

Zdeněk Žabokrtský <zabokrtsky@ufal.mff.cuni.cz>

COPYRIGHT AND LICENSE

Copyright © 2011 by Institute of Formal and Applied Linguistics, Charles University in Prague

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.