NAME

YATT::Lite::Types - define inner types at compile time.

SYNOPSIS

In module MyClass.pm:

package MyClass;
use YATT::Lite::Types
  (base => 'MyBaseClass'
   , [Album => fields => [qw/albumid artist title/]]
   , [CD    => fields => [qw/cdid    artist title/]]
   , [Track => fields => [qw/trackid cd     title/]]
 );

# Now you have MyClass::Album, MyClass::CD and MyClass::Track.
# also, alias (constant sub) of them are defined.

my Album $album = Album->new;

# my Albumm $album;
#  => No such class Albumm

my CD $cd = CD->new;

# $cd->{artistt};
#  => No such class field "artistt" in variable $cd of type MyClass::CD

my Track $track = {};

$track->{cd} = $cd;

# $track->{cdd} = $cd;
# => No such class field "cdd" in variable $track of type MyClass::Track

1;

DESCRIPTION

YATT::Lite::Types is a class builder, especially suitable to defining many inner classes at once.

Basic usage is like this:

use YATT::Lite::Types
  (OPTION => VALUE, ...
  , [SPEC]
  , [SPEC]
  ,  :
  );

where SPEC array for single type is written (TYPENAME + OPT VAL pair list) as:

[TYPENAME => OPTION => VALUE, ...]

Also you can write type hierachy in nested style as:

[BASETYPE => OPT => VAL, ...
  , [SUBTYPE1 => OPT => VAL, ...]
  , [SUBTYPE2 => OPT => VAL, ...
    , [SUBSUBTYPE1 => OPT => VAL, ...]
    , [SUBSUBTYPE2 => OPT => VAL, ...]
    ]
]

options

  • base

    Base class for newly created type. This name is preloaded before type definition (unless you specify no_require => 1).

  • no_require

  • alias

    To define alias(synonym) too, use this.

SEE ALSO

fields

1 POD Error

The following errors were encountered while parsing the POD:

Around line 246:

You forgot a '=back' before '=head1'