Next Roles 4

Basic problem of OO design

        package Moonpig::Role::HasCreatedAt;
        use Moose::Role;
        # ABSTRACT: a thing that has the created_at attribute
        use Moonpig::Types qw(Time);
        has created_at => (
          is => 'ro',
          isa => Time,
          default  => sub { Moonpig->env->now },
          init_arg => undef,
        );
        with 'Moonpig::Role::HasCreatedAt';

Next Copyright © 2013 M. J. Dominus