The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Kvasir::TypeDecl - Helper class for maintaining types used in engines

SYNOPSIS

  use Kvasir::TypeDecl;
  
  # Will create a Foo::Bar instance by calling new in Foo::Bar
  my $type1 = Kvasir::TypeDecl->new("Foo::Bar");
  my $obj1 = $type1->instantiate($engine);
  
  # Will keep around an already existing reference to an object
  # and return that when instantiating.
  my $existing_obj = get_some_object();
  my $type2 = Kvasir::TypeDecl->new($existing_obj);
  my $obj2 = $type2->instantiate($engine);

INTERFACE

CLASS METHODS

new ( TARGET, DEFAULTS [, ARGS ... ])

Wraps a type. If TARGET is an object it will be returned when instantiating the type. If not new will be called on TARGET with any ARGS passed as a list. DEFAULTS should be a reference to an array containg the names of default arguments sets in the engine in which we instanciate the type or a single defaults name. If no defaults are requested undef should be passed.

INSTANCE METHODS

instantiate ( ENGINE )

Instantiates the type in the engine ENGINE. See new above for semantics.