Moose Moose - It's the new camel #17

Build your own type constraints

package Time;

use Moose;
use Moose::Util::TypeConstraints;

use DateTime;

subtype 'DateTime' => as Object => where { $_->isa('DateTime') };

has 'time' => (
    is      => 'ro',
    isa     => 'DateTime',
    default => sub {
        DateTime->now();
    }
);
continued...
Copyright © 2007 Robert Boone