line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tak::Result; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
has type => (is => 'ro', required => 1); |
6
|
|
|
|
|
|
|
has data => (is => 'ro', required => 1); |
7
|
|
|
|
|
|
|
|
8
|
0
|
|
|
0
|
0
|
|
sub flatten { $_[0]->type, @{$_[0]->data} } |
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
0
|
0
|
|
sub is_success { $_[0]->type eq 'success' } |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub get { |
13
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
14
|
0
|
0
|
|
|
|
|
$self->throw unless $self->is_success; |
15
|
0
|
0
|
|
|
|
|
return wantarray ? @{$self->data} : $self->data->[0]; |
|
0
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub throw { |
19
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
20
|
0
|
|
|
|
|
|
die $self->exception; |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub exception { |
24
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
25
|
0
|
|
|
|
|
|
$self->type.': '.join ' ', @{$self->data}; |
|
0
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |