line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ============================================================================ |
2
|
|
|
|
|
|
|
package MooseX::App::Message::Block; |
3
|
|
|
|
|
|
|
# ============================================================================ |
4
|
|
|
|
|
|
|
|
5
|
15
|
|
|
15
|
|
309
|
use 5.010; |
|
15
|
|
|
|
|
57
|
|
6
|
15
|
|
|
15
|
|
96
|
use utf8; |
|
15
|
|
|
|
|
34
|
|
|
15
|
|
|
|
|
91
|
|
7
|
|
|
|
|
|
|
|
8
|
15
|
|
|
15
|
|
379
|
use namespace::autoclean; |
|
15
|
|
|
|
|
29
|
|
|
15
|
|
|
|
|
101
|
|
9
|
15
|
|
|
15
|
|
1368
|
use Moose; |
|
15
|
|
|
|
|
51
|
|
|
15
|
|
|
|
|
106
|
|
10
|
|
|
|
|
|
|
|
11
|
15
|
|
|
15
|
|
102547
|
use MooseX::App::Utils; |
|
15
|
|
|
|
|
40
|
|
|
15
|
|
|
|
|
544
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use overload |
14
|
15
|
|
|
15
|
|
91
|
'""' => "stringify"; |
|
15
|
|
|
|
|
35
|
|
|
15
|
|
|
|
|
135
|
|
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
|
21
|
my ($self) = @_; |
36
|
|
|
|
|
|
|
|
37
|
9
|
|
|
|
|
28
|
my $message = ''; |
38
|
9
|
100
|
|
|
|
340
|
$message .= $self->header."\n" |
39
|
|
|
|
|
|
|
if $self->has_header; |
40
|
|
|
|
|
|
|
|
41
|
9
|
50
|
|
|
|
321
|
$message .= $self->body."\n\n" |
42
|
|
|
|
|
|
|
if $self->has_body; |
43
|
|
|
|
|
|
|
|
44
|
9
|
|
|
|
|
53
|
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 |