| Next | Roles | 4 |
With roles, it's simple:
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,
);
Then each of Consumer, Coupon, Credit, and Invoice has:
with 'Moonpig::Role::HasCreatedAt';
| Next | ![]() |
Copyright © 2013 M. J. Dominus |