Skip to content

Instantly share code, notes, and snippets.

@thilp
Created September 28, 2013 14:21
Show Gist options
  • Save thilp/6742528 to your computer and use it in GitHub Desktop.
Save thilp/6742528 to your computer and use it in GitHub Desktop.
package Objects::Document;
use 5.010_001;
use strict;
use warnings;
our $VERSION = 1;
use Moose;
use Moose::Util::TypeConstraints;
subtype 'SpokenLanguage'
=> as 'Str'
=> where { $_ eq 'fr' || $_ eq 'en' }
=> message { 'known spoken languages: en, fr' };
has 'name' => (
is => 'ro',
isa => 'Str',
required => 1,
);
has 'written_in' => (
is => 'ro',
isa => 'SpokenLanguage',
);
no Moose;
__PACKAGE__->meta->make_immutable;
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment