Krang::DataSet - Krang interface to XML data sets


Creating data sets:

  # create a new data set
  my $set = pkg('DataSet')->new();
  # add an objects to it
  $set->add(object => $story);
  # add an object linked from another object
  $set->add(object => $media, from => $story);
  # add a file (used by media to include their files)
  $set->add(file => $file, path => $path, from => $media);
  # write it out to a kds file
  $set->write(path => "foo.kds");

Loading data sets:

  # load a data set from a file on disk
  my $set = pkg('DataSet')->new(path => "foo.kds");
  # get a list of objects in the set
  my @objects = $set->list();
  # import objects from the set, solving dependencies and updating links

Utility methods:

  # get list of all classes available for import/export
  my @classes = $set->classes;
  # get list of all valid ID method names (story_id, media_id, etc.)
  my @id_names = $set->id_meths;
  # find the class for a given ID method name
  my $class = $set->id_meth_to_class('story_id');


This modules manages export and import of XML data sets for Krang. This module is used by krang_export and krang_import. This module uses Krang::XML to serialize and deserialize individual objects.



As documented above, the methods in this class may throw the following exceptions:


Objects which are serialized in data-sets must support three methods: