line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package mop::traits::util; |
2
|
|
|
|
|
|
|
|
3
|
143
|
|
|
143
|
|
1678
|
use v5.16; |
|
143
|
|
|
|
|
551
|
|
|
143
|
|
|
|
|
6093
|
|
4
|
143
|
|
|
143
|
|
782
|
use warnings; |
|
143
|
|
|
|
|
278
|
|
|
143
|
|
|
|
|
6283
|
|
5
|
|
|
|
|
|
|
|
6
|
143
|
|
|
143
|
|
818
|
use Hash::Util::FieldHash qw[ fieldhash ]; |
|
143
|
|
|
|
|
298
|
|
|
143
|
|
|
|
|
47502
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.03'; |
9
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:STEVAN'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
fieldhash my %TRAIT_REGISTRATION; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub apply_trait { |
14
|
162
|
|
|
162
|
1
|
341
|
my ($trait, $meta, @args) = @_; |
15
|
|
|
|
|
|
|
|
16
|
162
|
|
|
|
|
660
|
$trait->( $meta, @args ); |
17
|
|
|
|
|
|
|
|
18
|
158
|
100
|
|
|
|
1817
|
$TRAIT_REGISTRATION{ $meta } = [] |
19
|
|
|
|
|
|
|
unless exists $TRAIT_REGISTRATION{ $meta }; |
20
|
158
|
|
|
|
|
872
|
push @{ $TRAIT_REGISTRATION{ $meta } } => { |
|
158
|
|
|
|
|
1416
|
|
21
|
|
|
|
|
|
|
trait => $trait, |
22
|
|
|
|
|
|
|
args => \@args, |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub applied_traits { |
27
|
3
|
|
|
3
|
1
|
6
|
my ($meta) = @_; |
28
|
3
|
50
|
|
|
|
13
|
return () unless exists $TRAIT_REGISTRATION{ $meta }; |
29
|
3
|
|
|
|
|
6
|
return @{ $TRAIT_REGISTRATION{ $meta } }; |
|
3
|
|
|
|
|
13
|
|
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
__END__ |