line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ============================================================================ |
2
|
|
|
|
|
|
|
package MooseX::App::Message::Block; |
3
|
|
|
|
|
|
|
# ============================================================================ |
4
|
|
|
|
|
|
|
|
5
|
15
|
|
|
15
|
|
283
|
use 5.010; |
|
15
|
|
|
|
|
49
|
|
6
|
15
|
|
|
15
|
|
90
|
use utf8; |
|
15
|
|
|
|
|
27
|
|
|
15
|
|
|
|
|
88
|
|
7
|
|
|
|
|
|
|
|
8
|
15
|
|
|
15
|
|
362
|
use namespace::autoclean; |
|
15
|
|
|
|
|
38
|
|
|
15
|
|
|
|
|
83
|
|
9
|
15
|
|
|
15
|
|
1173
|
use Moose; |
|
15
|
|
|
|
|
33
|
|
|
15
|
|
|
|
|
87
|
|
10
|
|
|
|
|
|
|
|
11
|
15
|
|
|
15
|
|
96810
|
use MooseX::App::Utils; |
|
15
|
|
|
|
|
34
|
|
|
15
|
|
|
|
|
531
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use overload |
14
|
15
|
|
|
15
|
|
98
|
'""' => "stringify"; |
|
15
|
|
|
|
|
32
|
|
|
15
|
|
|
|
|
150
|
|
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
|
22
|
my ($self) = @_; |
36
|
|
|
|
|
|
|
|
37
|
9
|
|
|
|
|
24
|
my $message = ''; |
38
|
9
|
100
|
|
|
|
296
|
$message .= $self->header."\n" |
39
|
|
|
|
|
|
|
if $self->has_header; |
40
|
|
|
|
|
|
|
|
41
|
9
|
50
|
|
|
|
304
|
$message .= $self->body."\n\n" |
42
|
|
|
|
|
|
|
if $self->has_body; |
43
|
|
|
|
|
|
|
|
44
|
9
|
|
|
|
|
45
|
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 |