line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mouse::Role; |
2
|
92
|
|
|
251
|
|
1055032
|
use Mouse::Exporter; # enables strict and warnings |
|
92
|
|
|
|
|
282
|
|
|
92
|
|
|
|
|
629
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = 'v2.4.10'; |
5
|
|
|
|
|
|
|
|
6
|
92
|
|
|
135
|
|
633
|
use Carp (); |
|
92
|
|
|
|
|
217
|
|
|
92
|
|
|
|
|
1511
|
|
7
|
92
|
|
|
135
|
|
507
|
use Scalar::Util (); |
|
92
|
|
|
|
|
207
|
|
|
92
|
|
|
|
|
1490
|
|
8
|
|
|
|
|
|
|
|
9
|
92
|
|
|
132
|
|
6918
|
use Mouse (); |
|
92
|
|
|
|
|
284
|
|
|
92
|
|
|
|
|
59372
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Mouse::Exporter->setup_import_methods( |
12
|
|
|
|
|
|
|
as_is => [qw( |
13
|
|
|
|
|
|
|
extends with |
14
|
|
|
|
|
|
|
has |
15
|
|
|
|
|
|
|
before after around |
16
|
|
|
|
|
|
|
override super |
17
|
|
|
|
|
|
|
augment inner |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
requires excludes |
20
|
|
|
|
|
|
|
), |
21
|
|
|
|
|
|
|
\&Scalar::Util::blessed, |
22
|
|
|
|
|
|
|
\&Carp::confess, |
23
|
|
|
|
|
|
|
], |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub extends { |
28
|
2
|
|
|
42
|
0
|
887
|
Carp::croak "Roles do not support 'extends'"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub with { |
32
|
36
|
|
|
76
|
0
|
12128
|
Mouse::Util::apply_all_roles(scalar(caller), @_); |
33
|
33
|
|
|
|
|
116
|
return; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub has { |
37
|
59
|
|
|
98
|
0
|
10747
|
my $meta = Mouse::Meta::Role->initialize(scalar caller); |
38
|
59
|
|
|
|
|
166
|
my $name = shift; |
39
|
|
|
|
|
|
|
|
40
|
59
|
50
|
|
|
|
241
|
$meta->throw_error(q{Usage: has 'name' => ( key => value, ... )}) |
41
|
|
|
|
|
|
|
if @_ % 2; # odd number of arguments |
42
|
|
|
|
|
|
|
|
43
|
59
|
100
|
|
|
|
293
|
for my $n(ref($name) ? @{$name} : $name){ |
|
1
|
|
|
|
|
3
|
|
44
|
61
|
|
|
|
|
307
|
$meta->add_attribute($n => @_); |
45
|
|
|
|
|
|
|
} |
46
|
59
|
|
|
|
|
237
|
return; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub before { |
50
|
8
|
|
|
47
|
0
|
2503
|
my $meta = Mouse::Meta::Role->initialize(scalar caller); |
51
|
8
|
|
|
|
|
18
|
my $code = pop; |
52
|
8
|
|
|
|
|
50
|
for my $name($meta->_collect_methods(@_)) { |
53
|
7
|
|
|
|
|
100
|
$meta->add_before_method_modifier($name => $code); |
54
|
|
|
|
|
|
|
} |
55
|
7
|
|
|
|
|
21
|
return; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub after { |
59
|
12
|
|
|
12
|
0
|
464
|
my $meta = Mouse::Meta::Role->initialize(scalar caller); |
60
|
12
|
|
|
|
|
38
|
my $code = pop; |
61
|
12
|
|
|
|
|
72
|
for my $name($meta->_collect_methods(@_)) { |
62
|
11
|
|
|
|
|
127
|
$meta->add_after_method_modifier($name => $code); |
63
|
|
|
|
|
|
|
} |
64
|
11
|
|
|
|
|
41
|
return; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub around { |
68
|
12
|
|
|
12
|
0
|
944
|
my $meta = Mouse::Meta::Role->initialize(scalar caller); |
69
|
12
|
|
|
|
|
38
|
my $code = pop; |
70
|
12
|
|
|
|
|
97
|
for my $name($meta->_collect_methods(@_)) { |
71
|
12
|
|
|
|
|
149
|
$meta->add_around_method_modifier($name => $code); |
72
|
|
|
|
|
|
|
} |
73
|
11
|
|
|
|
|
38
|
return; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub super { |
78
|
12
|
50
|
|
12
|
0
|
81
|
return if !defined $Mouse::SUPER_BODY; |
79
|
12
|
|
|
|
|
41
|
$Mouse::SUPER_BODY->(@Mouse::SUPER_ARGS); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub override { |
83
|
|
|
|
|
|
|
# my($name, $code) = @_; |
84
|
9
|
|
|
9
|
0
|
123
|
Mouse::Meta::Role->initialize(scalar caller)->add_override_method_modifier(@_); |
85
|
8
|
|
|
|
|
23
|
return; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# We keep the same errors messages as Moose::Role emits, here. |
89
|
|
|
|
|
|
|
sub inner { |
90
|
1
|
|
|
1
|
0
|
644
|
Carp::croak "Roles cannot support 'inner'"; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub augment { |
94
|
1
|
|
|
1
|
0
|
943
|
Carp::croak "Roles cannot support 'augment'"; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub requires { |
98
|
21
|
|
|
21
|
1
|
2017
|
my $meta = Mouse::Meta::Role->initialize(scalar caller); |
99
|
21
|
50
|
|
|
|
88
|
$meta->throw_error("Must specify at least one method") unless @_; |
100
|
21
|
|
|
|
|
108
|
$meta->add_required_methods(@_); |
101
|
21
|
|
|
|
|
49
|
return; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub excludes { |
105
|
1
|
|
|
1
|
1
|
424
|
Mouse::Util::not_supported(); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub init_meta{ |
109
|
200
|
|
|
200
|
0
|
403
|
shift; |
110
|
200
|
|
|
|
|
756
|
my %args = @_; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
my $class = $args{for_class} |
113
|
200
|
50
|
|
|
|
710
|
or Carp::confess("Cannot call init_meta without specifying a for_class"); |
114
|
|
|
|
|
|
|
|
115
|
200
|
|
50
|
|
|
1141
|
my $metaclass = $args{metaclass} || 'Mouse::Meta::Role'; |
116
|
|
|
|
|
|
|
|
117
|
200
|
|
|
|
|
1628
|
my $meta = $metaclass->initialize($class); |
118
|
200
|
|
|
|
|
1333
|
my $filename = Mouse::Util::module_notional_filename($meta->name); |
119
|
|
|
|
|
|
|
$INC{$filename} = '(set by Mouse)' |
120
|
200
|
100
|
|
|
|
960
|
unless exists $INC{$filename}; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
$meta->add_method(meta => sub{ |
123
|
93
|
|
33
|
93
|
|
28229
|
$metaclass->initialize(ref($_[0]) || $_[0]); |
|
|
|
|
93
|
|
|
|
|
|
|
|
70
|
|
|
|
124
|
200
|
|
|
|
|
2680
|
}); |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
# make a role type for each Mouse role |
127
|
200
|
100
|
|
|
|
896
|
Mouse::Util::TypeConstraints::role_type($class) |
128
|
|
|
|
|
|
|
unless Mouse::Util::TypeConstraints::find_type_constraint($class); |
129
|
|
|
|
|
|
|
|
130
|
200
|
|
|
|
|
925
|
return $meta; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
1; |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
__END__ |