1package Color::Palette::Schema; 2{ 3 $Color::Palette::Schema::VERSION = '0.100003'; 4} 5use Moose; 6# ABSTRACT: requirements for a palette 7 8use Color::Palette; 9use Color::Palette::Types qw(ColorName); 10use MooseX::Types::Moose qw(ArrayRef); 11 12 13has required_colors => ( 14 is => 'ro', 15 isa => ArrayRef[ ColorName ], 16 required => 1, 17); 18 19 20sub check { 21 my ($self, $palette) = @_; 22 23 # ->color will throw an exception on unknown colors, doing our job for us. 24 # -- rjbs, 2009-05-19 25 $palette->color($_) for @{ $self->required_colors }; 26} 27 281; 29 30__END__ 31 32=pod 33 34=encoding UTF-8 35 36=head1 NAME 37 38Color::Palette::Schema - requirements for a palette 39 40=head1 VERSION 41 42version 0.100003 43 44=head1 DESCRIPTION 45 46Most of this is documented in L<Color::Palette>. Below is just a bit more 47documentation. 48 49=head1 ATTRIBUTES 50 51=head2 required_colors 52 53This is an arrayref of color names that must be present in any palette checked 54against this schema. 55 56=head1 METHODS 57 58=head2 check 59 60 $schema->check($palette); 61 62This method will throw an exception if the given palette doesn't meet the 63requirements of the schema. 64 65=head1 AUTHOR 66 67Ricardo SIGNES <rjbs@cpan.org> 68 69=head1 COPYRIGHT AND LICENSE 70 71This software is copyright (c) 2013 by Ricardo SIGNES. 72 73This is free software; you can redistribute it and/or modify it under 74the same terms as the Perl 5 programming language system itself. 75 76=cut 77