line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mouse; |
2
|
282
|
|
|
437
|
|
2966207
|
use 5.008_005; |
|
282
|
|
|
|
|
793
|
|
3
|
|
|
|
|
|
|
|
4
|
282
|
|
|
396
|
|
70959
|
use Mouse::Exporter; # enables strict and warnings |
|
282
|
|
|
|
|
422
|
|
|
282
|
|
|
|
|
1204
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = 'v2.4.9'; |
7
|
|
|
|
|
|
|
|
8
|
282
|
|
|
343
|
|
1151
|
use Carp (); |
|
282
|
|
|
|
|
324
|
|
|
282
|
|
|
|
|
3516
|
|
9
|
282
|
|
|
310
|
|
851
|
use Scalar::Util (); |
|
282
|
|
|
|
|
329
|
|
|
282
|
|
|
|
|
3440
|
|
10
|
|
|
|
|
|
|
|
11
|
282
|
|
|
282
|
|
792
|
use Mouse::Util (); |
|
282
|
|
|
|
|
293
|
|
|
282
|
|
|
|
|
3707
|
|
12
|
|
|
|
|
|
|
|
13
|
282
|
|
|
282
|
|
837
|
use Mouse::Meta::Module; |
|
282
|
|
|
|
|
271
|
|
|
282
|
|
|
|
|
5965
|
|
14
|
282
|
|
|
282
|
|
106548
|
use Mouse::Meta::Class; |
|
282
|
|
|
|
|
489
|
|
|
282
|
|
|
|
|
6299
|
|
15
|
282
|
|
|
282
|
|
99506
|
use Mouse::Meta::Role; |
|
282
|
|
|
|
|
470
|
|
|
282
|
|
|
|
|
10170
|
|
16
|
282
|
|
|
282
|
|
103524
|
use Mouse::Meta::Attribute; |
|
282
|
|
|
|
|
472
|
|
|
282
|
|
|
|
|
7205
|
|
17
|
282
|
|
|
282
|
|
93858
|
use Mouse::Object; |
|
282
|
|
|
|
|
436
|
|
|
282
|
|
|
|
|
5717
|
|
18
|
282
|
|
|
282
|
|
102885
|
use Mouse::Util::TypeConstraints (); |
|
282
|
|
|
|
|
443
|
|
|
282
|
|
|
|
|
148469
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Mouse::Exporter->setup_import_methods( |
21
|
|
|
|
|
|
|
as_is => [qw( |
22
|
|
|
|
|
|
|
extends with |
23
|
|
|
|
|
|
|
has |
24
|
|
|
|
|
|
|
before after around |
25
|
|
|
|
|
|
|
override super |
26
|
|
|
|
|
|
|
augment inner |
27
|
|
|
|
|
|
|
), |
28
|
|
|
|
|
|
|
\&Scalar::Util::blessed, |
29
|
|
|
|
|
|
|
\&Carp::confess, |
30
|
|
|
|
|
|
|
], |
31
|
|
|
|
|
|
|
); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub extends { |
35
|
121
|
|
|
121
|
1
|
13001
|
Mouse::Meta::Class->initialize(scalar caller)->superclasses(@_); |
36
|
119
|
|
|
|
|
359
|
return; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub with { |
40
|
115
|
|
|
115
|
0
|
19499
|
Mouse::Util::apply_all_roles(scalar(caller), @_); |
41
|
98
|
|
|
|
|
249
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub has { |
45
|
505
|
|
|
505
|
1
|
74062
|
my $meta = Mouse::Meta::Class->initialize(scalar caller); |
46
|
505
|
|
|
|
|
830
|
my $name = shift; |
47
|
|
|
|
|
|
|
|
48
|
505
|
100
|
|
|
|
1853
|
$meta->throw_error(q{Usage: has 'name' => ( key => value, ... )}) |
49
|
|
|
|
|
|
|
if @_ % 2; # odd number of arguments |
50
|
|
|
|
|
|
|
|
51
|
504
|
100
|
|
|
|
1250
|
for my $n(ref($name) ? @{$name} : $name){ |
|
3
|
|
|
|
|
6
|
|
52
|
508
|
|
|
|
|
1710
|
$meta->add_attribute($n => @_); |
53
|
|
|
|
|
|
|
} |
54
|
482
|
|
|
|
|
972
|
return; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub before { |
58
|
9
|
|
|
9
|
1
|
433
|
my $meta = Mouse::Meta::Class->initialize(scalar caller); |
59
|
9
|
|
|
|
|
11
|
my $code = pop; |
60
|
9
|
|
|
|
|
38
|
for my $name($meta->_collect_methods(@_)) { |
61
|
10
|
|
|
|
|
28
|
$meta->add_before_method_modifier($name => $code); |
62
|
|
|
|
|
|
|
} |
63
|
9
|
|
|
|
|
15
|
return; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub after { |
67
|
10
|
|
|
10
|
1
|
69
|
my $meta = Mouse::Meta::Class->initialize(scalar caller); |
68
|
10
|
|
|
|
|
15
|
my $code = pop; |
69
|
10
|
|
|
|
|
38
|
for my $name($meta->_collect_methods(@_)) { |
70
|
12
|
|
|
|
|
37
|
$meta->add_after_method_modifier($name => $code); |
71
|
|
|
|
|
|
|
} |
72
|
10
|
|
|
|
|
1278
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub around { |
76
|
16
|
|
|
16
|
1
|
120
|
my $meta = Mouse::Meta::Class->initialize(scalar caller); |
77
|
16
|
|
|
|
|
21
|
my $code = pop; |
78
|
16
|
|
|
|
|
158
|
for my $name($meta->_collect_methods(@_)) { |
79
|
17
|
|
|
|
|
49
|
$meta->add_around_method_modifier($name => $code); |
80
|
|
|
|
|
|
|
} |
81
|
16
|
|
|
|
|
188
|
return; |
82
|
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
our $SUPER_PACKAGE; |
85
|
|
|
|
|
|
|
our $SUPER_BODY; |
86
|
|
|
|
|
|
|
our @SUPER_ARGS; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub super { |
89
|
|
|
|
|
|
|
# This check avoids a recursion loop - see |
90
|
|
|
|
|
|
|
# t/100_bugs/020_super_recursion.t |
91
|
16
|
100
|
100
|
16
|
0
|
121
|
return if defined $SUPER_PACKAGE && $SUPER_PACKAGE ne caller(); |
92
|
15
|
100
|
|
|
|
82
|
return if !defined $SUPER_BODY; |
93
|
14
|
|
|
|
|
39
|
$SUPER_BODY->(@SUPER_ARGS); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub override { |
97
|
|
|
|
|
|
|
# my($name, $method) = @_; |
98
|
14
|
|
|
14
|
0
|
1534
|
Mouse::Meta::Class->initialize(scalar caller)->add_override_method_modifier(@_); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
our %INNER_BODY; |
102
|
|
|
|
|
|
|
our %INNER_ARGS; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub inner { |
105
|
21
|
|
|
21
|
0
|
1558
|
my $pkg = caller(); |
106
|
21
|
100
|
|
|
|
201
|
if ( my $body = $INNER_BODY{$pkg} ) { |
107
|
12
|
|
|
|
|
14
|
my $args = $INNER_ARGS{$pkg}; |
108
|
12
|
|
|
|
|
16
|
local $INNER_ARGS{$pkg}; |
109
|
12
|
|
|
|
|
14
|
local $INNER_BODY{$pkg}; |
110
|
12
|
|
|
|
|
11
|
return $body->(@{$args}); |
|
12
|
|
|
|
|
31
|
|
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
else { |
113
|
9
|
|
|
|
|
17
|
return; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub augment { |
118
|
|
|
|
|
|
|
#my($name, $method) = @_; |
119
|
11
|
|
|
11
|
0
|
109
|
Mouse::Meta::Class->initialize(scalar caller)->add_augment_method_modifier(@_); |
120
|
10
|
|
|
|
|
17
|
return; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub init_meta { |
124
|
571
|
|
|
571
|
0
|
673
|
shift; |
125
|
571
|
|
|
|
|
1172
|
my %args = @_; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
my $class = $args{for_class} |
128
|
571
|
50
|
|
|
|
1355
|
or confess("Cannot call init_meta without specifying a for_class"); |
129
|
|
|
|
|
|
|
|
130
|
571
|
|
100
|
|
|
2505
|
my $base_class = $args{base_class} || 'Mouse::Object'; |
131
|
571
|
|
50
|
|
|
1747
|
my $metaclass = $args{metaclass} || 'Mouse::Meta::Class'; |
132
|
|
|
|
|
|
|
|
133
|
571
|
|
|
|
|
3129
|
my $meta = $metaclass->initialize($class); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
$meta->add_method(meta => sub{ |
136
|
451
|
|
66
|
451
|
|
91055
|
return $metaclass->initialize(ref($_[0]) || $_[0]); |
|
|
|
|
451
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
|
147
|
|
|
|
137
|
571
|
|
|
|
|
6952
|
}); |
138
|
|
|
|
|
|
|
|
139
|
571
|
100
|
|
|
|
1648
|
$meta->superclasses($base_class) |
140
|
|
|
|
|
|
|
unless $meta->superclasses; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
# make a class type for each Mouse class |
143
|
571
|
100
|
|
|
|
1508
|
Mouse::Util::TypeConstraints::class_type($class) |
144
|
|
|
|
|
|
|
unless Mouse::Util::TypeConstraints::find_type_constraint($class); |
145
|
|
|
|
|
|
|
|
146
|
571
|
|
|
|
|
1625
|
return $meta; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
1; |
150
|
|
|
|
|
|
|
__END__ |