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