| 1 | package Data::Message::Simple; | ||||||||||
| 2 | |||||||||||
| 3 | 6 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 6 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 6 | ▶ | use Mo qw(build is); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 6 | ▶ | use Mo::utils 0.15 qw(check_length check_required check_strings); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 6 | ▶ | use Mo::utils::Language 0.05 qw(check_language_639_1); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 6 | ▶ | use Readonly; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | |||||||||||
| 11 | 6 | Readonly::Array our @TYPES => qw(info error); | |||||||||
| 12 | |||||||||||
| 13 | 6 | our $VERSION = 0.05; | |||||||||
| 14 | |||||||||||
| 15 | 6 | has lang => ( | |||||||||
| 16 | is => 'ro', | ||||||||||
| 17 | ); | ||||||||||
| 18 | |||||||||||
| 19 | 6 | has text => ( | |||||||||
| 20 | is => 'ro', | ||||||||||
| 21 | ); | ||||||||||
| 22 | |||||||||||
| 23 | 6 | has type => ( | |||||||||
| 24 | is => 'ro', | ||||||||||
| 25 | ); | ||||||||||
| 26 | |||||||||||
| 27 | 12 | ▶ | sub BUILD { | ||||||||
|
Subroutine
BUILD: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 28 | 12 | my $self = shift; | |||||||||
| 29 | |||||||||||
| 30 | # Check lang. | ||||||||||
| 31 | 12 | check_language_639_1($self, 'lang'); | |||||||||
| 32 | |||||||||||
| 33 | # Check text. | ||||||||||
| 34 | 11 | check_required($self, 'text'); | |||||||||
| 35 | 10 | check_length($self, 'text', 4096); | |||||||||
| 36 | |||||||||||
| 37 | # Check message type. | ||||||||||
| 38 | 9 | ▶ | if (! defined $self->{'type'}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 5 | $self->{'type'} = 'info'; | |||||||||
| 40 | } | ||||||||||
| 41 | 9 | check_strings($self, 'type', \@TYPES); | |||||||||
| 42 | |||||||||||
| 43 | 8 | return; | |||||||||
| 44 | } | ||||||||||
| 45 | |||||||||||
| 46 | 6 | 1; | |||||||||
| 47 | |||||||||||
| 48 | __END__ | ||||||||||