Created
September 28, 2013 14:21
-
-
Save thilp/6742528 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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