NAME

Class::Lego::Constructor - Automated constructor generation

SYNOPSIS

use Class::Lego::Constructor; # exports defer and lazy
BEGIN {
  @ISA = qw( Class::Lego::Constructor );
}

__PACKAGE__->mk_constructor0({
  magical_number   => 42,
  timestamp => defer { DateTime->new },
});
# the weird name, mk_constructor0, is on purpose while API settles

DESCRIPTION

NOTE: That modules was formely Class::Constructor::Factory.
It will enter the Class-Lego dist soon.

I like the simplicity of Class::Accessor and friends. With them, creating accessors is a piece of cake. It does give me a default constructor as well.

The case is that this default constructor is not as convenient as the generated accessors. To be precise, I want to specify default values for attributes easily. This module is a tentative solution to this problem.

---