line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mouse::Role; |
2
|
92
|
|
|
251
|
|
831338
|
use Mouse::Exporter; # enables strict and warnings |
|
92
|
|
|
|
|
159
|
|
|
92
|
|
|
|
|
423
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = 'v2.4.9'; |
5
|
|
|
|
|
|
|
|
6
|
92
|
|
|
135
|
|
358
|
use Carp (); |
|
92
|
|
|
|
|
117
|
|
|
92
|
|
|
|
|
1077
|
|
7
|
92
|
|
|
135
|
|
270
|
use Scalar::Util (); |
|
92
|
|
|
|
|
94
|
|
|
92
|
|
|
|
|
1005
|
|
8
|
|
|
|
|
|
|
|
9
|
92
|
|
|
132
|
|
4633
|
use Mouse (); |
|
92
|
|
|
|
|
143
|
|
|
92
|
|
|
|
|
43075
|
|
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
|
776
|
Carp::croak "Roles do not support 'extends'"; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub with { |
32
|
36
|
|
|
76
|
0
|
9373
|
Mouse::Util::apply_all_roles(scalar(caller), @_); |
33
|
33
|
|
|
|
|
78
|
return; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub has { |
37
|
59
|
|
|
98
|
0
|
6457
|
my $meta = Mouse::Meta::Role->initialize(scalar caller); |
38
|
59
|
|
|
|
|
107
|
my $name = shift; |
39
|
|
|
|
|
|
|
|
40
|
59
|
50
|
|
|
|
892
|
$meta->throw_error(q{Usage: has 'name' => ( key => value, ... )}) |
41
|
|
|
|
|
|
|
if @_ % 2; # odd number of arguments |
42
|
|
|
|
|
|
|
|
43
|
59
|
100
|
|
|
|
178
|
for my $n(ref($name) ? @{$name} : $name){ |
|
1
|
|
|
|
|
3
|
|
44
|
61
|
|
|
|
|
229
|
$meta->add_attribute($n => @_); |
45
|
|
|
|
|
|
|
} |
46
|
59
|
|
|
|
|
183
|
return; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub before { |
50
|
8
|
|
|
47
|
0
|
1850
|
my $meta = Mouse::Meta::Role->initialize(scalar caller); |
51
|
8
|
|
|
|
|
16
|
my $code = pop; |
52
|
8
|
|
|
|
|
122
|
for my $name($meta->_collect_methods(@_)) { |
53
|
7
|
|
|
|
|
78
|
$meta->add_before_method_modifier($name => $code); |
54
|
|
|
|
|
|
|
} |
55
|
7
|
|
|
|
|
15
|
return; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub after { |
59
|
12
|
|
|
12
|
0
|
395
|
my $meta = Mouse::Meta::Role->initialize(scalar caller); |
60
|
12
|
|
|
|
|
24
|
my $code = pop; |
61
|
12
|
|
|
|
|
51
|
for my $name($meta->_collect_methods(@_)) { |
62
|
11
|
|
|
|
|
75
|
$meta->add_after_method_modifier($name => $code); |
63
|
|
|
|
|
|
|
} |
64
|
11
|
|
|
|
|
19
|
return; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub around { |
68
|
12
|
|
|
12
|
0
|
777
|
my $meta = Mouse::Meta::Role->initialize(scalar caller); |
69
|
12
|
|
|
|
|
25
|
my $code = pop; |
70
|
12
|
|
|
|
|
75
|
for my $name($meta->_collect_methods(@_)) { |
71
|
12
|
|
|
|
|
230
|
$meta->add_around_method_modifier($name => $code); |
72
|
|
|
|
|
|
|
} |
73
|
11
|
|
|
|
|
30
|
return; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub super { |
78
|
12
|
50
|
|
12
|
0
|
48
|
return if !defined $Mouse::SUPER_BODY; |
79
|
12
|
|
|
|
|
23
|
$Mouse::SUPER_BODY->(@Mouse::SUPER_ARGS); |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
sub override { |
83
|
|
|
|
|
|
|
# my($name, $code) = @_; |
84
|
9
|
|
|
9
|
0
|
67
|
Mouse::Meta::Role->initialize(scalar caller)->add_override_method_modifier(@_); |
85
|
8
|
|
|
|
|
14
|
return; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
# We keep the same errors messages as Moose::Role emits, here. |
89
|
|
|
|
|
|
|
sub inner { |
90
|
1
|
|
|
1
|
0
|
508
|
Carp::croak "Roles cannot support 'inner'"; |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
sub augment { |
94
|
1
|
|
|
1
|
0
|
936
|
Carp::croak "Roles cannot support 'augment'"; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub requires { |
98
|
21
|
|
|
21
|
1
|
1294
|
my $meta = Mouse::Meta::Role->initialize(scalar caller); |
99
|
21
|
50
|
|
|
|
65
|
$meta->throw_error("Must specify at least one method") unless @_; |
100
|
21
|
|
|
|
|
673
|
$meta->add_required_methods(@_); |
101
|
21
|
|
|
|
|
36
|
return; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub excludes { |
105
|
1
|
|
|
1
|
1
|
391
|
Mouse::Util::not_supported(); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub init_meta{ |
109
|
200
|
|
|
200
|
0
|
186
|
shift; |
110
|
200
|
|
|
|
|
398
|
my %args = @_; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
my $class = $args{for_class} |
113
|
200
|
50
|
|
|
|
460
|
or Carp::confess("Cannot call init_meta without specifying a for_class"); |
114
|
|
|
|
|
|
|
|
115
|
200
|
|
50
|
|
|
796
|
my $metaclass = $args{metaclass} || 'Mouse::Meta::Role'; |
116
|
|
|
|
|
|
|
|
117
|
200
|
|
|
|
|
1203
|
my $meta = $metaclass->initialize($class); |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
$meta->add_method(meta => sub{ |
120
|
93
|
|
33
|
93
|
|
22943
|
$metaclass->initialize(ref($_[0]) || $_[0]); |
|
|
|
|
93
|
|
|
|
|
|
|
|
70
|
|
|
|
121
|
200
|
|
|
|
|
2385
|
}); |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
# make a role type for each Mouse role |
124
|
200
|
100
|
|
|
|
538
|
Mouse::Util::TypeConstraints::role_type($class) |
125
|
|
|
|
|
|
|
unless Mouse::Util::TypeConstraints::find_type_constraint($class); |
126
|
|
|
|
|
|
|
|
127
|
200
|
|
|
|
|
568
|
return $meta; |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
1; |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
__END__ |