line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ============================================================================ |
2
|
|
|
|
|
|
|
package MooseX::App::Message::Block; |
3
|
|
|
|
|
|
|
# ============================================================================ |
4
|
|
|
|
|
|
|
|
5
|
14
|
|
|
14
|
|
271
|
use 5.010; |
|
14
|
|
|
|
|
36
|
|
6
|
14
|
|
|
14
|
|
47
|
use utf8; |
|
14
|
|
|
|
|
19
|
|
|
14
|
|
|
|
|
73
|
|
7
|
|
|
|
|
|
|
|
8
|
14
|
|
|
14
|
|
255
|
use namespace::autoclean; |
|
14
|
|
|
|
|
16
|
|
|
14
|
|
|
|
|
83
|
|
9
|
14
|
|
|
14
|
|
882
|
use Moose; |
|
14
|
|
|
|
|
22
|
|
|
14
|
|
|
|
|
65
|
|
10
|
|
|
|
|
|
|
|
11
|
14
|
|
|
14
|
|
62112
|
use MooseX::App::Utils; |
|
14
|
|
|
|
|
22
|
|
|
14
|
|
|
|
|
388
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use overload |
14
|
14
|
|
|
14
|
|
54
|
'""' => "stringify"; |
|
14
|
|
|
|
|
22
|
|
|
14
|
|
|
|
|
118
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has 'header' => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
isa => 'MooseX::App::Types::MessageString', |
19
|
|
|
|
|
|
|
predicate => 'has_header', |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'type' => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
isa => 'Str', |
25
|
|
|
|
|
|
|
default => sub {'default'}, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has 'body' => ( |
29
|
|
|
|
|
|
|
is => 'ro', |
30
|
|
|
|
|
|
|
isa => 'MooseX::App::Types::MessageString', |
31
|
|
|
|
|
|
|
predicate => 'has_body', |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub stringify { |
35
|
9
|
|
|
9
|
1
|
11
|
my ($self) = @_; |
36
|
|
|
|
|
|
|
|
37
|
9
|
|
|
|
|
11
|
my $message = ''; |
38
|
9
|
100
|
|
|
|
232
|
$message .= $self->header."\n" |
39
|
|
|
|
|
|
|
if $self->has_header; |
40
|
|
|
|
|
|
|
|
41
|
9
|
50
|
|
|
|
223
|
$message .= $self->body."\n\n" |
42
|
|
|
|
|
|
|
if $self->has_body; |
43
|
|
|
|
|
|
|
|
44
|
9
|
|
|
|
|
29
|
return $message; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
48
|
|
|
|
|
|
|
1; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
__END__ |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=encoding utf8 |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 NAME |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
MooseX::App::Message::Block - Message block |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 DESCRIPTION |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
A simple message block with a header and body |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 METHODS |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head2 header |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Read/set a header string |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 has_header |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
Check if a header is set |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=head2 body |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
Read/set a body string |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=head2 has_body |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
Check if a body is set |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 type |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Read/set an arbitrary block type. Defaults to 'default' |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 stringify |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Stringify a message block |