line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ## Hide from PAUSE |
2
|
|
|
|
|
|
|
MooseX::Types::Structured::MessageStack; |
3
|
|
|
|
|
|
|
|
4
|
20
|
|
|
20
|
|
2796
|
use Moose; |
|
20
|
|
|
|
|
34
|
|
|
20
|
|
|
|
|
156
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
has 'level' => ( |
7
|
|
|
|
|
|
|
traits => ['Counter'], |
8
|
|
|
|
|
|
|
is => 'ro', |
9
|
|
|
|
|
|
|
isa => 'Num', |
10
|
|
|
|
|
|
|
required => 0, |
11
|
|
|
|
|
|
|
default => 0, |
12
|
|
|
|
|
|
|
handles => { |
13
|
|
|
|
|
|
|
inc_level => 'inc', |
14
|
|
|
|
|
|
|
dec_level => 'dec', |
15
|
|
|
|
|
|
|
}, |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
has 'messages' => ( |
19
|
|
|
|
|
|
|
traits => ['Array'], |
20
|
|
|
|
|
|
|
is => 'ro', |
21
|
|
|
|
|
|
|
isa => 'ArrayRef[HashRef]', |
22
|
|
|
|
|
|
|
required => 1, |
23
|
|
|
|
|
|
|
default => sub { [] }, |
24
|
|
|
|
|
|
|
handles => { |
25
|
|
|
|
|
|
|
has_messages => 'count', |
26
|
|
|
|
|
|
|
add_message => 'push', |
27
|
|
|
|
|
|
|
all_messages => 'elements', |
28
|
|
|
|
|
|
|
}, |
29
|
|
|
|
|
|
|
); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub as_string { |
32
|
18
|
|
|
18
|
0
|
889
|
my @messages = (shift)->all_messages; |
33
|
|
|
|
|
|
|
my @flattened_msgs = map { |
34
|
18
|
|
|
|
|
40
|
"\n". (" " x $_->{level}) ."[+] " . $_->{message}; |
|
23
|
|
|
|
|
119
|
|
35
|
|
|
|
|
|
|
} reverse @messages; |
36
|
|
|
|
|
|
|
|
37
|
18
|
|
|
|
|
81
|
return join("", @flattened_msgs); |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
20
|
|
|
20
|
|
127398
|
no Moose; |
|
20
|
|
|
|
|
47
|
|
|
20
|
|
|
|
|
115
|
|
41
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |