NAME

GT::Serializable - Add XML serialization functions to any object


DESCRIPTION

The functions available in GT::Serializable can add serialization support to any simple perl object.

The various functions will serialize any hash, array or scalar value blessed as an object.

Any object can be made serializable by adding GT::Serializable in @ISA :

  our @ISA = qw(GT::Serializable);

All hash items whose names start with an underscore won't be stored in the serialization process.


RESTRICTIONS

Any reference to something else than a hash, array or scalar value will be ignored (including function and file descriptor).


HOOKS

Once an object is created from scratch based on a serialization dump, $object->init_after_load() is called so that the object has a chance to restore things that may have not been stored (such as reference to internal functions).


FUTURE

We may define later other hooks that will let the module personalize the name of elements used to store the object in the XML file.


FUNCTIONS

$self->as_string()
my $a = Module->create_from_string()
$self->store("file" | \*FILE)
my $a = Module->create_from_file("file" | \*FILE)