line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
33
|
|
|
33
|
|
13401
|
use v5.14; |
|
33
|
|
|
|
|
120
|
|
2
|
33
|
|
|
33
|
|
178
|
use strict; |
|
33
|
|
|
|
|
73
|
|
|
33
|
|
|
|
|
985
|
|
3
|
33
|
|
|
33
|
|
168
|
use warnings FATAL => 'all'; |
|
33
|
|
|
|
|
63
|
|
|
33
|
|
|
|
|
1478
|
|
4
|
33
|
|
|
33
|
|
195
|
no warnings qw(void once uninitialized numeric); |
|
33
|
|
|
|
|
79
|
|
|
33
|
|
|
|
|
2663
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
package Moops::Keyword::Role; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:TOBYINK'; |
9
|
|
|
|
|
|
|
our $VERSION = '0.038'; |
10
|
|
|
|
|
|
|
|
11
|
12
|
|
|
12
|
|
99
|
use Moo; |
|
12
|
|
|
21
|
|
31
|
|
|
12
|
|
|
|
|
75
|
|
|
21
|
|
|
|
|
140
|
|
|
21
|
|
|
|
|
67
|
|
|
21
|
|
|
|
|
128
|
|
12
|
12
|
|
|
12
|
|
10774
|
use B qw(perlstring); |
|
12
|
|
|
21
|
|
37
|
|
|
12
|
|
|
|
|
10347
|
|
|
21
|
|
|
|
|
22216
|
|
|
21
|
|
|
|
|
60
|
|
|
21
|
|
|
|
|
17751
|
|
13
|
|
|
|
|
|
|
extends qw( Moops::Keyword ); |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
0
|
0
|
0
|
sub should_support_methods { 1 } |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub arguments_for_moosex_mungehas |
18
|
|
|
|
|
|
|
{ |
19
|
83
|
|
|
83
|
0
|
346
|
shift; |
20
|
83
|
|
|
|
|
482
|
return qw(eq_1); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my %using = ( |
24
|
|
|
|
|
|
|
Moo => 'use Moo::Role; use MooX::late;', |
25
|
|
|
|
|
|
|
Moose => 'use Moose::Role; use MooseX::KavorkaInfo;', |
26
|
|
|
|
|
|
|
Mouse => 'use Mouse::Role;', |
27
|
|
|
|
|
|
|
Tiny => 'use Role::Tiny;', |
28
|
|
|
|
|
|
|
( |
29
|
|
|
|
|
|
|
map { $_ => "use $_;" } |
30
|
|
|
|
|
|
|
qw/ Role::Basic Role::Tiny Moo::Role Mouse::Role Moose::Role / |
31
|
|
|
|
|
|
|
), |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub default_oo_implementation |
35
|
|
|
|
|
|
|
{ |
36
|
139
|
|
|
139
|
0
|
484
|
'Moo'; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub generate_package_setup_oo |
40
|
|
|
|
|
|
|
{ |
41
|
19
|
|
|
19
|
0
|
58
|
my $self = shift; |
42
|
19
|
|
66
|
|
|
175
|
my $using = $self->relations->{using}[0] // $self->default_oo_implementation; |
43
|
|
|
|
|
|
|
|
44
|
19
|
50
|
|
|
|
98
|
exists($using{$using}) |
45
|
|
|
|
|
|
|
or Carp::croak("Cannot create a package using $using; stopped"); |
46
|
|
|
|
|
|
|
|
47
|
19
|
|
|
|
|
69
|
my @lines = ( |
48
|
|
|
|
|
|
|
'use namespace::autoclean -also => ["has", "lexical_has"];', |
49
|
|
|
|
|
|
|
'use Lexical::Accessor;', |
50
|
|
|
|
|
|
|
); |
51
|
19
|
50
|
|
|
|
115
|
push @lines, "use MooseX::MungeHas qw(@{[ $self->arguments_for_moosex_mungehas ]});" |
|
19
|
|
|
|
|
76
|
|
52
|
|
|
|
|
|
|
if $using =~ /^Mo/; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
return ( |
55
|
19
|
|
|
|
|
88
|
$using{$using}, |
56
|
|
|
|
|
|
|
$self->generate_package_setup_relationships, |
57
|
|
|
|
|
|
|
@lines, |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub generate_package_setup_relationships |
62
|
|
|
|
|
|
|
{ |
63
|
83
|
|
|
83
|
0
|
186
|
my $self = shift; |
64
|
83
|
100
|
|
|
|
171
|
my @roles = @{ $self->relations->{with} || [] }; |
|
83
|
|
|
|
|
585
|
|
65
|
|
|
|
|
|
|
|
66
|
83
|
100
|
|
|
|
392
|
$self->_mk_guard( |
67
|
|
|
|
|
|
|
sprintf("with(%s);", join(",", map perlstring($_), @roles)) |
68
|
|
|
|
|
|
|
) if @roles; |
69
|
83
|
|
|
|
|
454
|
return; |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
around known_relationships => sub |
73
|
|
|
|
|
|
|
{ |
74
|
|
|
|
|
|
|
my $next = shift; |
75
|
|
|
|
|
|
|
my $self = shift; |
76
|
|
|
|
|
|
|
return($self->$next(@_), qw/ with using /); |
77
|
|
|
|
|
|
|
}; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
around qualify_relationship => sub |
80
|
|
|
|
|
|
|
{ |
81
|
|
|
|
|
|
|
my $next = shift; |
82
|
|
|
|
|
|
|
my $self = shift; |
83
|
|
|
|
|
|
|
$_[0] eq 'using' ? !!0 : $self->$next(@_); |
84
|
|
|
|
|
|
|
}; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
around version_relationship => sub |
87
|
|
|
|
|
|
|
{ |
88
|
|
|
|
|
|
|
my $next = shift; |
89
|
|
|
|
|
|
|
my $self = shift; |
90
|
|
|
|
|
|
|
$_[0] eq 'using' ? !!0 : $self->$next(@_); |
91
|
|
|
|
|
|
|
}; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
around arguments_for_kavorka => sub |
94
|
|
|
|
|
|
|
{ |
95
|
|
|
|
|
|
|
my $next = shift; |
96
|
|
|
|
|
|
|
my $self = shift; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
my @keywords = qw/ method before after around /; |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
my $using = $self->relations->{using}[0] // $self->default_oo_implementation; |
101
|
|
|
|
|
|
|
push @keywords, qw/ override augment / |
102
|
|
|
|
|
|
|
if $using =~ /^Mo[ou]se\b/; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
return ( |
105
|
|
|
|
|
|
|
$self->$next(@_), |
106
|
|
|
|
|
|
|
@keywords, |
107
|
|
|
|
|
|
|
); |
108
|
|
|
|
|
|
|
}; |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
1; |