line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mouse; |
2
|
282
|
|
|
437
|
|
3446637
|
use 5.008_005; |
|
282
|
|
|
|
|
1947
|
|
3
|
|
|
|
|
|
|
|
4
|
282
|
|
|
396
|
|
84056
|
use Mouse::Exporter; # enables strict and warnings |
|
282
|
|
|
|
|
837
|
|
|
282
|
|
|
|
|
1744
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = 'v2.4.10'; |
7
|
|
|
|
|
|
|
|
8
|
282
|
|
|
310
|
|
1885
|
use Carp (); |
|
282
|
|
|
|
|
631
|
|
|
282
|
|
|
|
|
4834
|
|
9
|
282
|
|
|
282
|
|
1487
|
use Scalar::Util (); |
|
282
|
|
|
|
|
610
|
|
|
282
|
|
|
|
|
4506
|
|
10
|
|
|
|
|
|
|
|
11
|
282
|
|
|
282
|
|
1383
|
use Mouse::Util (); |
|
282
|
|
|
|
|
700
|
|
|
282
|
|
|
|
|
5144
|
|
12
|
|
|
|
|
|
|
|
13
|
282
|
|
|
282
|
|
1624
|
use Mouse::Meta::Module; |
|
282
|
|
|
|
|
646
|
|
|
282
|
|
|
|
|
8607
|
|
14
|
282
|
|
|
282
|
|
133681
|
use Mouse::Meta::Class; |
|
282
|
|
|
|
|
935
|
|
|
282
|
|
|
|
|
8482
|
|
15
|
282
|
|
|
282
|
|
117326
|
use Mouse::Meta::Role; |
|
282
|
|
|
|
|
921
|
|
|
282
|
|
|
|
|
7964
|
|
16
|
282
|
|
|
282
|
|
120402
|
use Mouse::Meta::Attribute; |
|
282
|
|
|
|
|
911
|
|
|
282
|
|
|
|
|
9436
|
|
17
|
282
|
|
|
282
|
|
110906
|
use Mouse::Object; |
|
282
|
|
|
|
|
883
|
|
|
282
|
|
|
|
|
7443
|
|
18
|
282
|
|
|
282
|
|
112663
|
use Mouse::Util::TypeConstraints (); |
|
282
|
|
|
|
|
1012
|
|
|
282
|
|
|
|
|
215134
|
|
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
|
19533
|
Mouse::Meta::Class->initialize(scalar caller)->superclasses(@_); |
36
|
119
|
|
|
|
|
535
|
return; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub with { |
40
|
115
|
|
|
115
|
0
|
28315
|
Mouse::Util::apply_all_roles(scalar(caller), @_); |
41
|
98
|
|
|
|
|
413
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub has { |
45
|
505
|
|
|
505
|
1
|
116431
|
my $meta = Mouse::Meta::Class->initialize(scalar caller); |
46
|
505
|
|
|
|
|
1414
|
my $name = shift; |
47
|
|
|
|
|
|
|
|
48
|
505
|
100
|
|
|
|
1889
|
$meta->throw_error(q{Usage: has 'name' => ( key => value, ... )}) |
49
|
|
|
|
|
|
|
if @_ % 2; # odd number of arguments |
50
|
|
|
|
|
|
|
|
51
|
504
|
100
|
|
|
|
1678
|
for my $n(ref($name) ? @{$name} : $name){ |
|
3
|
|
|
|
|
8
|
|
52
|
508
|
|
|
|
|
2206
|
$meta->add_attribute($n => @_); |
53
|
|
|
|
|
|
|
} |
54
|
482
|
|
|
|
|
1440
|
return; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub before { |
58
|
9
|
|
|
9
|
1
|
528
|
my $meta = Mouse::Meta::Class->initialize(scalar caller); |
59
|
9
|
|
|
|
|
27
|
my $code = pop; |
60
|
9
|
|
|
|
|
61
|
for my $name($meta->_collect_methods(@_)) { |
61
|
10
|
|
|
|
|
42
|
$meta->add_before_method_modifier($name => $code); |
62
|
|
|
|
|
|
|
} |
63
|
9
|
|
|
|
|
32
|
return; |
64
|
|
|
|
|
|
|
} |
65
|
283
|
|
|
344
|
|
5074
|
|
|
283
|
|
|
|
|
691
|
|
|
283
|
|
|
|
|
26201
|
|
66
|
|
|
|
|
|
|
sub after { |
67
|
10
|
|
|
10
|
1
|
125
|
my $meta = Mouse::Meta::Class->initialize(scalar caller); |
68
|
10
|
|
|
|
|
28
|
my $code = pop; |
69
|
10
|
|
|
|
|
59
|
for my $name($meta->_collect_methods(@_)) { |
70
|
12
|
|
|
|
|
55
|
$meta->add_after_method_modifier($name => $code); |
71
|
|
|
|
|
|
|
} |
72
|
10
|
|
|
|
|
2077
|
return; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub around { |
76
|
16
|
|
|
16
|
1
|
203
|
my $meta = Mouse::Meta::Class->initialize(scalar caller); |
77
|
16
|
|
|
|
|
47
|
my $code = pop; |
78
|
16
|
|
|
|
|
88
|
for my $name($meta->_collect_methods(@_)) { |
79
|
17
|
|
|
|
|
76
|
$meta->add_around_method_modifier($name => $code); |
80
|
|
|
|
|
|
|
} |
81
|
16
|
|
|
|
|
441
|
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
|
193
|
return if defined $SUPER_PACKAGE && $SUPER_PACKAGE ne caller(); |
92
|
15
|
100
|
|
|
|
203
|
return if !defined $SUPER_BODY; |
93
|
14
|
|
|
|
|
68
|
$SUPER_BODY->(@SUPER_ARGS); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub override { |
97
|
|
|
|
|
|
|
# my($name, $method) = @_; |
98
|
14
|
|
|
14
|
0
|
2648
|
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
|
3109
|
my $pkg = caller(); |
106
|
21
|
100
|
|
|
|
365
|
if ( my $body = $INNER_BODY{$pkg} ) { |
107
|
12
|
|
|
|
|
24
|
my $args = $INNER_ARGS{$pkg}; |
108
|
12
|
|
|
|
|
33
|
local $INNER_ARGS{$pkg}; |
109
|
12
|
|
|
|
|
24
|
local $INNER_BODY{$pkg}; |
110
|
12
|
|
|
|
|
25
|
return $body->(@{$args}); |
|
12
|
|
|
|
|
44
|
|
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
else { |
113
|
9
|
|
|
|
|
28
|
return; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub augment { |
118
|
|
|
|
|
|
|
#my($name, $method) = @_; |
119
|
11
|
|
|
11
|
0
|
170
|
Mouse::Meta::Class->initialize(scalar caller)->add_augment_method_modifier(@_); |
120
|
10
|
|
|
|
|
31
|
return; |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub init_meta { |
124
|
571
|
|
|
571
|
0
|
1358
|
shift; |
125
|
571
|
|
|
|
|
2091
|
my %args = @_; |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
my $class = $args{for_class} |
128
|
571
|
50
|
|
|
|
2503
|
or confess("Cannot call init_meta without specifying a for_class"); |
129
|
|
|
|
|
|
|
|
130
|
571
|
|
100
|
|
|
3414
|
my $base_class = $args{base_class} || 'Mouse::Object'; |
131
|
571
|
|
50
|
|
|
2747
|
my $metaclass = $args{metaclass} || 'Mouse::Meta::Class'; |
132
|
|
|
|
|
|
|
|
133
|
571
|
|
|
|
|
4526
|
my $meta = $metaclass->initialize($class); |
134
|
571
|
|
|
|
|
4657
|
my $filename = Mouse::Util::module_notional_filename($meta->name); |
135
|
|
|
|
|
|
|
$INC{$filename} = '(set by Mouse)' |
136
|
571
|
100
|
|
|
|
2850
|
unless exists $INC{$filename}; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
$meta->add_method(meta => sub{ |
139
|
451
|
|
66
|
451
|
|
153818
|
return $metaclass->initialize(ref($_[0]) || $_[0]); |
|
|
|
|
451
|
|
|
|
|
|
|
|
355
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
|
147
|
|
|
|
140
|
571
|
|
|
|
|
8304
|
}); |
141
|
|
|
|
|
|
|
|
142
|
571
|
100
|
|
|
|
2799
|
$meta->superclasses($base_class) |
143
|
|
|
|
|
|
|
unless $meta->superclasses; |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
# make a class type for each Mouse class |
146
|
571
|
100
|
|
|
|
2756
|
Mouse::Util::TypeConstraints::class_type($class) |
147
|
|
|
|
|
|
|
unless Mouse::Util::TypeConstraints::find_type_constraint($class); |
148
|
|
|
|
|
|
|
|
149
|
571
|
|
|
|
|
2531
|
return $meta; |
150
|
|
|
|
|
|
|
} |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
1; |
153
|
|
|
|
|
|
|
__END__ |