Class methods to save and reload a datastructure to a file.


 use SaveLoad;
 my $struct = [ 'test',
                { key1 => 'val1',
                  key2 => 'val2' },
                [ 1,
                  { key11 => 'val11',
                    key22 => 'val21' },
 SaveLoad->write_struct('/tmp/test', $struct);
 $struct = undef
 $struct = SaveLoad->load_struct('/tmp/test');


SaveLoad->write_struct($file_path, $struct);
Writes the data structure $struct to a file $file_path. $struct may be a reference to an array where each array element may be a string, a number or a reference to an array or hash. $struct may be a reference to an hash where each key is a string or number and values may be strings, numbers or a references to an array or hash. The whole structure is dumped to file $file_path.

$struct = SaveLoad->load_struct($file_path);
Reloads a previously dumped data structure from a file.


Copyright 2004-2013 Thedi gerber@id.ethz.ch