NAME

XML::Comma::Util::DefModule - Abstract parent for modules that define a Def in a __DATA__ block.

DESCRIPTION

This module provides an easy way to define a Def inside a module. Children of XML::Comma::Util::DefModule inherit two methods:

load_def

new

The Def is created from a string found in the DATA section of the module. The load_def() method should be called by the inheriting class, in order to load the Def into Comma's weltenshmatzel. The default new() method simply returns a new Doc of the Def's type, and can be used as-is or overridden. A complete, basic inheritor might look like this:

package Example::Frobulator;

use strict;
use warnings;

use base 'XML::Comma::Util::DefModule';
__PACKAGE__->load_def;

1;

__DATA__

<DocumentDefinition>
  <name>Example_Frobulator_Def</name>
  <class><module>Example::Frobulator</module></class>

  <element><name>frobuvalue</name></element>
</DocumentDefinition>