| 
 
 NAMEClass::Tangram::Generator - Generate Class::Tangram-based objects at runtime. SYNOPSIS  use Class::Tangram::Generator;
  my $schema = { ... }; # a Tangram schema definition hashref,
                        # including all classes
  my $gen = new Class::Tangram::Generator $schema;
  my $orange = $gen->new('Orange');
  $orange->juicyness(10); # $orange is a Class::Tangram-based Orange object
DESCRIPTIONThe purpose of Class::Tangram::Generator is to facilitate the rapid development of Class::Tangram-based objects in the Tangram framework. Instead of having to write class modules for all your Tangram objects, many of which only inherit from Class::Tangram for accessor and constraint checking, you use Class::Tangram::Generator to dynamically instantiate each class as necessary, at runtime. This also alleviates the long litany of 'use Orange; use Apple; ... ' statements in all of your scripts. METHODS
 DISCUSSIONTangram Schema ExtensionsTo provide custom methods for each class, add subroutine references to the 'methods' key in the schema:   Orange => {
    fields => { int => [ qw(juicyness ripeness) ] },
    methods => {
      squeeze => sub {
        my $self = shift;
        $self->juicyness($self->juicyness() - 1);
      },
      eviscerate => sub {
        my $self = shift;
        $self->juicyness(0);
      }
    }
  }
The subroutines will be automatically installed into the class's namespace. Interoperation with existing package filesIf a .pm module file corresponding to the requested class can be found by Perl (looking in the usual places defined by @INC, PERL5LIB, etc.), it will be loaded before Class::Tangram::Generator has finished dynamically generating the package. This means that any schema and/or methods found in the .pm module file will be overriden by those specified in the schema given to Class::Tangram::Generator. For example, there may be an Orange.pm module file that looks like:   package Orange;
  sub rehydrate { shift->juicyness(10) }
  1;
This allows the addition of more lengthy subroutines without filling up the schema with lots of code. But a "rehydrate" method specified in the schema would entirely replace this subroutine (and it would not be available via SUPER). EXPORTClass::Tangram::Generator does not have any methods to export. HISTORY
 AUTHORAaron J Mackey <amackey@virginia.edu> SEE ALSOClass::Tangram, Tangram, Class::Object, perl. 
 
  |