| 1 | package Data::Message::Board; | ||
| 2 | |||
| 3 | 16 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 16 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 0 | ▶ | use Mo qw(build default is); |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 7 | use Mo::utils 0.28 qw(check_isa check_length check_required); | ||
| 8 | use Mo::utils::Array qw(check_array_object); | ||
| 9 | use Mo::utils::Number qw(check_positive_natural); | ||
| 10 | |||
| 11 | our $VERSION = 0.06; | ||
| 12 | |||
| 13 | has author => ( | ||
| 14 | is => 'ro', | ||
| 15 | ); | ||
| 16 | |||
| 17 | has comments => ( | ||
| 18 | default => [], | ||
| 19 | is => 'ro', | ||
| 20 | ); | ||
| 21 | |||
| 22 | has date => ( | ||
| 23 | is => 'ro', | ||
| 24 | ); | ||
| 25 | |||
| 26 | has id => ( | ||
| 27 | is => 'ro', | ||
| 28 | ); | ||
| 29 | |||
| 30 | has message => ( | ||
| 31 | is => 'ro', | ||
| 32 | ); | ||
| 33 | |||
| 34 | sub BUILD { | ||
| 35 | my $self = shift; | ||
| 36 | |||
| 37 | # Check author. | ||
| 38 | check_required($self, 'author'); | ||
| 39 | check_isa($self, 'author', 'Data::Person'); | ||
| 40 | |||
| 41 | # Check comments. | ||
| 42 | check_array_object($self, 'comments', 'Data::Message::Board::Comment'); | ||
| 43 | |||
| 44 | # Check date. | ||
| 45 | check_required($self, 'date'); | ||
| 46 | check_isa($self, 'date', 'DateTime'); | ||
| 47 | |||
| 48 | # Check id. | ||
| 49 | check_positive_natural($self, 'id'); | ||
| 50 | |||
| 51 | # Check message. | ||
| 52 | check_required($self, 'message'); | ||
| 53 | check_length($self, 'message', 4096); | ||
| 54 | |||
| 55 | return; | ||
| 56 | } | ||
| 57 | |||
| 58 | 1; | ||
| 59 | |||
| 60 | __END__ | ||