line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooX::Keyword::Chain; |
2
|
2
|
|
|
2
|
|
276231
|
use 5.006; use strict; use warnings; |
|
2
|
|
|
2
|
|
11
|
|
|
2
|
|
|
2
|
|
12
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
74
|
|
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
91
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
4
|
2
|
|
|
2
|
|
563
|
use Moo; our %CHAINS; |
|
2
|
|
|
|
|
10949
|
|
|
2
|
|
|
|
|
14
|
|
5
|
|
|
|
|
|
|
use MooX::Keyword { |
6
|
|
|
|
|
|
|
chain => { |
7
|
|
|
|
|
|
|
builder => sub { |
8
|
3
|
|
|
|
|
24646
|
my ($moo, $name, $chain, $cb) = @_; |
9
|
3
|
50
|
|
|
|
10
|
do { |
10
|
0
|
|
|
|
|
0
|
$cb = $chain; |
11
|
0
|
|
|
|
|
0
|
$chain = ""; |
12
|
|
|
|
|
|
|
} if ! $cb; |
13
|
3
|
100
|
|
|
|
39
|
$moo->has($name, is => 'rw') if ! $CHAINS{$name}++; |
14
|
|
|
|
|
|
|
$moo->around($name, sub { |
15
|
3
|
|
|
|
|
1483
|
my ($orig, $self, @args) = @_; |
16
|
3
|
|
|
|
|
42
|
@args = $self->$orig(@args); |
17
|
3
|
|
|
|
|
6
|
@args = eval { |
18
|
3
|
|
|
|
|
10
|
$cb->($self, @args); |
19
|
|
|
|
|
|
|
}; |
20
|
3
|
50
|
|
|
|
26
|
die "${chain}: $@" if ($@); |
21
|
3
|
100
|
|
|
|
13
|
return wantarray ? @args : shift @args; |
22
|
3
|
|
|
|
|
379
|
}); |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
} |
25
|
2
|
|
|
2
|
|
2628
|
}; |
|
2
|
|
|
|
|
11963
|
|
|
2
|
|
|
|
|
28
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
1; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
__END__ |