line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ArrayDataRole::Spec::Basic; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
566
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
24
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use Role::Tiny; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
7
|
1
|
|
|
1
|
|
157
|
use Role::Tiny::With; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
346
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
10
|
|
|
|
|
|
|
our $DATE = '2021-12-01'; # DATE |
11
|
|
|
|
|
|
|
our $DIST = 'ArrayData'; # DIST |
12
|
|
|
|
|
|
|
our $VERSION = '0.2.5'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# constructor |
15
|
|
|
|
|
|
|
requires 'new'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# mixin |
18
|
|
|
|
|
|
|
with 'Role::TinyCommons::Iterator::Resettable'; |
19
|
|
|
|
|
|
|
with 'Role::TinyCommons::Collection::GetItemByPos'; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# provides |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my @role_prefixes = qw(ArrayDataRole Role::TinyCommons::Collection); |
24
|
|
|
|
|
|
|
sub apply_roles { |
25
|
0
|
|
|
0
|
1
|
|
my ($obj, @unqualified_roles) = @_; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my @roles_to_apply; |
28
|
|
|
|
|
|
|
ROLE: |
29
|
0
|
|
|
|
|
|
for my $ur (@unqualified_roles) { |
30
|
|
|
|
|
|
|
PREFIX: |
31
|
0
|
|
|
|
|
|
for my $prefix (@role_prefixes) { |
32
|
0
|
|
|
|
|
|
my ($mod, $modpm); |
33
|
0
|
|
|
|
|
|
$mod = "$prefix\::$ur"; |
34
|
0
|
|
|
|
|
|
($modpm = "$mod.pm") =~ s!::!/!g; |
35
|
0
|
|
|
|
|
|
eval { require $modpm; 1 }; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
unless ($@) { |
37
|
|
|
|
|
|
|
#print "D:$mod\n"; |
38
|
0
|
|
|
|
|
|
push @roles_to_apply, $mod; |
39
|
0
|
|
|
|
|
|
next ROLE; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
} |
42
|
0
|
|
|
|
|
|
die "Can't find role '$ur' to apply (searched these prefixes: ". |
43
|
|
|
|
|
|
|
join(", ", @role_prefixes); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
Role::Tiny->apply_roles_to_object($obj, @roles_to_apply); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# return something useful |
49
|
0
|
|
|
|
|
|
$obj; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
### |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
1; |
55
|
|
|
|
|
|
|
# ABSTRACT: Required methods for all ArrayData::* modules |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
__END__ |