line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mouse; |
2
|
282
|
|
|
437
|
|
2830743
|
use 5.008_005; |
|
282
|
|
|
|
|
727
|
|
3
|
|
|
|
|
|
|
|
4
|
282
|
|
|
396
|
|
69442
|
use Mouse::Exporter; # enables strict and warnings |
|
282
|
|
|
|
|
392
|
|
|
282
|
|
|
|
|
1159
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = 'v2.4.8'; |
7
|
|
|
|
|
|
|
|
8
|
282
|
|
|
343
|
|
1110
|
use Carp (); |
|
282
|
|
|
|
|
311
|
|
|
282
|
|
|
|
|
3419
|
|
9
|
282
|
|
|
310
|
|
822
|
use Scalar::Util (); |
|
282
|
|
|
|
|
290
|
|
|
282
|
|
|
|
|
3364
|
|
10
|
|
|
|
|
|
|
|
11
|
282
|
|
|
282
|
|
779
|
use Mouse::Util (); |
|
282
|
|
|
|
|
282
|
|
|
282
|
|
|
|
|
3741
|
|
12
|
|
|
|
|
|
|
|
13
|
282
|
|
|
282
|
|
967
|
use Mouse::Meta::Module; |
|
282
|
|
|
|
|
284
|
|
|
282
|
|
|
|
|
5800
|
|
14
|
282
|
|
|
282
|
|
104281
|
use Mouse::Meta::Class; |
|
282
|
|
|
|
|
453
|
|
|
282
|
|
|
|
|
6123
|
|
15
|
282
|
|
|
282
|
|
95511
|
use Mouse::Meta::Role; |
|
282
|
|
|
|
|
452
|
|
|
282
|
|
|
|
|
9939
|
|
16
|
282
|
|
|
282
|
|
103313
|
use Mouse::Meta::Attribute; |
|
282
|
|
|
|
|
460
|
|
|
282
|
|
|
|
|
6874
|
|
17
|
282
|
|
|
282
|
|
91163
|
use Mouse::Object; |
|
282
|
|
|
|
|
395
|
|
|
282
|
|
|
|
|
5554
|
|
18
|
282
|
|
|
282
|
|
99959
|
use Mouse::Util::TypeConstraints (); |
|
282
|
|
|
|
|
441
|
|
|
282
|
|
|
|
|
143522
|
|
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
|
13562
|
Mouse::Meta::Class->initialize(scalar caller)->superclasses(@_); |
36
|
119
|
|
|
|
|
336
|
return; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub with { |
40
|
115
|
|
|
115
|
0
|
19525
|
Mouse::Util::apply_all_roles(scalar(caller), @_); |
41
|
98
|
|
|
|
|
264
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub has { |
45
|
505
|
|
|
505
|
1
|
80004
|
my $meta = Mouse::Meta::Class->initialize(scalar caller); |
46
|
505
|
|
|
|
|
809
|
my $name = shift; |
47
|
|
|
|
|
|
|
|
48
|
505
|
100
|
|
|
|
1766
|
$meta->throw_error(q{Usage: has 'name' => ( key => value, ... )}) |
49
|
|
|
|
|
|
|
if @_ % 2; # odd number of arguments |
50
|
|
|
|
|
|
|
|
51
|
504
|
100
|
|
|
|
1243
|
for my $n(ref($name) ? @{$name} : $name){ |
|
3
|
|
|
|
|
6
|
|
52
|
508
|
|
|
|
|
1659
|
$meta->add_attribute($n => @_); |
53
|
|
|
|
|
|
|
} |
54
|
482
|
|
|
|
|
931
|
return; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub before { |
58
|
9
|
|
|
9
|
1
|
431
|
my $meta = Mouse::Meta::Class->initialize(scalar caller); |
59
|
9
|
|
|
|
|
11
|
my $code = pop; |
60
|
9
|
|
|
|
|
39
|
for my $name($meta->_collect_methods(@_)) { |
61
|
10
|
|
|
|
|
39
|
$meta->add_before_method_modifier($name => $code); |
62
|
|
|
|
|
|
|
} |
63
|
9
|
|
|
|
|
15
|
return; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub after { |
67
|
10
|
|
|
10
|
1
|
70
|
my $meta = Mouse::Meta::Class->initialize(scalar caller); |
68
|
10
|
|
|
|
|
14
|
my $code = pop; |
69
|
10
|
|
|
|
|
37
|
for my $name($meta->_collect_methods(@_)) { |
70
|
12
|
|
|
|
|
39
|
$meta->add_after_method_modifier($name => $code); |
71
|
|
|
|
|
|
|
} |
72
|
10
|
|
|
|
|
1075
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub around { |
76
|
16
|
|
|
16
|
1
|
121
|
my $meta = Mouse::Meta::Class->initialize(scalar caller); |
77
|
16
|
|
|
|
|
18
|
my $code = pop; |
78
|
16
|
|
|
|
|
144
|
for my $name($meta->_collect_methods(@_)) { |
79
|
17
|
|
|
|
|
45
|
$meta->add_around_method_modifier($name => $code); |
80
|
|
|
|
|
|
|
} |
81
|
16
|
|
|
|
|
189
|
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
|
119
|
return if defined $SUPER_PACKAGE && $SUPER_PACKAGE ne caller(); |
92
|
15
|
100
|
|
|
|
85
|
return if !defined $SUPER_BODY; |
93
|
14
|
|
|
|
|
34
|
$SUPER_BODY->(@SUPER_ARGS); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub override { |
97
|
|
|
|
|
|
|
# my($name, $method) = @_; |
98
|
14
|
|
|
14
|
0
|
1810
|
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
|
1449
|
my $pkg = caller(); |
106
|
21
|
100
|
|
|
|
183
|
if ( my $body = $INNER_BODY{$pkg} ) { |
107
|
12
|
|
|
|
|
13
|
my $args = $INNER_ARGS{$pkg}; |
108
|
12
|
|
|
|
|
12
|
local $INNER_ARGS{$pkg}; |
109
|
12
|
|
|
|
|
12
|
local $INNER_BODY{$pkg}; |
110
|
12
|
|
|
|
|
14
|
return $body->(@{$args}); |
|
12
|
|
|
|
|
20
|
|
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
else { |
113
|
9
|
|
|
|
|
16
|
return; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub augment { |
118
|
|
|
|
|
|
|
#my($name, $method) = @_; |
119
|
11
|
|
|
11
|
0
|
110
|
Mouse::Meta::Class->initialize(scalar caller)->add_augment_method_modifier(@_); |
120
|
10
|
|
|
|
|
16
|
return; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub init_meta { |
124
|
571
|
|
|
571
|
0
|
711
|
shift; |
125
|
571
|
|
|
|
|
1139
|
my %args = @_; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
my $class = $args{for_class} |
128
|
571
|
50
|
|
|
|
1315
|
or confess("Cannot call init_meta without specifying a for_class"); |
129
|
|
|
|
|
|
|
|
130
|
571
|
|
100
|
|
|
2460
|
my $base_class = $args{base_class} || 'Mouse::Object'; |
131
|
571
|
|
50
|
|
|
1989
|
my $metaclass = $args{metaclass} || 'Mouse::Meta::Class'; |
132
|
|
|
|
|
|
|
|
133
|
571
|
|
|
|
|
3020
|
my $meta = $metaclass->initialize($class); |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
$meta->add_method(meta => sub{ |
136
|
451
|
|
66
|
451
|
|
378740
|
return $metaclass->initialize(ref($_[0]) || $_[0]); |
|
|
|
|
451
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
|
147
|
|
|
|
137
|
571
|
|
|
|
|
6907
|
}); |
138
|
|
|
|
|
|
|
|
139
|
571
|
100
|
|
|
|
1614
|
$meta->superclasses($base_class) |
140
|
|
|
|
|
|
|
unless $meta->superclasses; |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
# make a class type for each Mouse class |
143
|
571
|
100
|
|
|
|
1505
|
Mouse::Util::TypeConstraints::class_type($class) |
144
|
|
|
|
|
|
|
unless Mouse::Util::TypeConstraints::find_type_constraint($class); |
145
|
|
|
|
|
|
|
|
146
|
571
|
|
|
|
|
1648
|
return $meta; |
147
|
|
|
|
|
|
|
} |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
1; |
150
|
|
|
|
|
|
|
__END__ |