line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Moose::Meta::Method::Overridden; |
2
|
|
|
|
|
|
|
our $VERSION = '2.2203'; |
3
|
|
|
|
|
|
|
|
4
|
391
|
|
|
8470
|
|
2519
|
use strict; |
|
391
|
|
|
|
|
787
|
|
|
391
|
|
|
|
|
10434
|
|
5
|
391
|
|
|
8314
|
|
1828
|
use warnings; |
|
391
|
|
|
|
|
754
|
|
|
391
|
|
|
|
|
9528
|
|
6
|
|
|
|
|
|
|
|
7
|
391
|
|
|
6202
|
|
1934
|
use parent 'Moose::Meta::Method'; |
|
391
|
|
|
|
|
823
|
|
|
391
|
|
|
|
|
2928
|
|
8
|
|
|
|
|
|
|
|
9
|
391
|
|
|
6160
|
|
23662
|
use Moose::Util 'throw_exception'; |
|
391
|
|
|
|
|
821
|
|
|
391
|
|
|
|
|
2308
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
1012
|
|
|
6781
|
1
|
3928
|
my ( $class, %args ) = @_; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# the package can be overridden by roles |
15
|
|
|
|
|
|
|
# it is really more like body's compilation stash |
16
|
|
|
|
|
|
|
# this is where we need to override the definition of super() so that the |
17
|
|
|
|
|
|
|
# body of the code can call the right overridden version |
18
|
1012
|
|
66
|
|
|
2951
|
my $super_package = $args{package} || $args{class}->name; |
19
|
|
|
|
|
|
|
|
20
|
1012
|
|
|
|
|
1713
|
my $name = $args{name}; |
21
|
|
|
|
|
|
|
|
22
|
1012
|
|
|
|
|
3544
|
my $super = $args{class}->find_next_method_by_name($name); |
23
|
|
|
|
|
|
|
|
24
|
1012
|
100
|
|
|
|
2470
|
(defined $super) |
25
|
|
|
|
|
|
|
|| throw_exception( CannotOverrideNoSuperMethod => class => $class, |
26
|
|
|
|
|
|
|
params => \%args, |
27
|
|
|
|
|
|
|
method_name => $name |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
1010
|
|
|
|
|
2956
|
my $super_body = $super->body; |
31
|
|
|
|
|
|
|
|
32
|
1010
|
|
|
|
|
1738
|
my $method = $args{method}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $body = sub { |
35
|
2423
|
|
|
7662
|
|
18751
|
local $Moose::SUPER_PACKAGE = $super_package; |
|
|
|
|
5694
|
|
|
|
|
|
|
|
5842
|
|
|
|
|
|
|
|
8071
|
|
|
|
|
|
|
|
7706
|
|
|
|
|
|
|
|
5431
|
|
|
|
|
|
|
|
4844
|
|
|
|
|
|
|
|
4769
|
|
|
|
|
|
|
|
4769
|
|
|
|
|
|
|
|
4727
|
|
|
|
|
|
|
|
4727
|
|
|
|
|
|
|
|
4399
|
|
|
|
|
|
|
|
4153
|
|
|
|
|
|
|
|
4153
|
|
|
|
|
|
|
|
3407
|
|
|
|
|
|
|
|
3407
|
|
|
|
|
|
|
|
3407
|
|
|
|
|
|
|
|
3209
|
|
|
|
|
|
|
|
2998
|
|
|
|
|
|
|
|
2998
|
|
|
|
|
|
|
|
2998
|
|
|
|
|
|
|
|
2998
|
|
|
|
|
|
|
|
2998
|
|
|
|
|
|
|
|
2752
|
|
|
|
|
|
|
|
2752
|
|
|
|
|
|
|
|
2752
|
|
|
|
|
|
|
|
2752
|
|
|
|
|
|
|
|
2752
|
|
|
|
|
|
|
|
2752
|
|
|
|
|
|
|
|
2541
|
|
|
|
|
|
|
|
2541
|
|
|
|
|
|
|
|
2541
|
|
|
|
|
|
|
|
2379
|
|
|
|
|
|
|
|
2122
|
|
|
|
|
|
|
|
2122
|
|
|
|
|
|
|
|
2122
|
|
|
|
|
|
|
|
2122
|
|
|
|
|
|
|
|
2122
|
|
|
|
|
|
|
|
2122
|
|
|
|
|
|
|
|
2122
|
|
|
|
|
|
|
|
2122
|
|
|
|
|
|
|
|
2122
|
|
|
|
|
|
|
|
1399
|
|
|
|
|
|
|
|
1237
|
|
|
|
|
|
|
|
1237
|
|
|
|
|
|
|
|
1237
|
|
|
|
|
|
|
|
1237
|
|
|
|
|
|
|
|
1237
|
|
|
|
|
|
|
|
1237
|
|
|
|
|
|
|
|
1237
|
|
|
|
|
|
|
|
1237
|
|
|
|
|
|
|
|
1237
|
|
|
|
|
|
|
|
1237
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
|
257
|
|
|
|
36
|
2423
|
|
|
|
|
5694
|
local @Moose::SUPER_ARGS = @_; |
37
|
2423
|
|
|
|
|
3812
|
local $Moose::SUPER_BODY = $super_body; |
38
|
2423
|
|
|
|
|
5984
|
return $method->(@_); |
39
|
1010
|
|
|
|
|
4569
|
}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
# FIXME do we need this make sure this works for next::method? |
42
|
|
|
|
|
|
|
# subname "${super_package}::${name}", $method; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# FIXME store additional attrs |
45
|
|
|
|
|
|
|
$class->wrap( |
46
|
|
|
|
|
|
|
$body, |
47
|
|
|
|
|
|
|
package_name => $args{class}->name, |
48
|
1010
|
|
|
|
|
4428
|
name => $name |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# ABSTRACT: A Moose Method metaclass for overridden methods |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
__END__ |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=pod |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=encoding UTF-8 |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head1 NAME |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Moose::Meta::Method::Overridden - A Moose Method metaclass for overridden methods |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 VERSION |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
version 2.2203 |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 DESCRIPTION |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
This class implements method overriding logic for the L<Moose> |
73
|
|
|
|
|
|
|
C<override> keyword. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
The overriding subroutine's parent will be invoked explicitly using |
76
|
|
|
|
|
|
|
the C<super> keyword from the parent class's method definition. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 METHODS |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 Moose::Meta::Method::Overridden->new(%options) |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This constructs a new object. It accepts the following options: |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=over 4 |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=item * class |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
The metaclass object for the class in which the override is being |
89
|
|
|
|
|
|
|
declared. This option is required. |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item * name |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
The name of the method which we are overriding. This method must exist |
94
|
|
|
|
|
|
|
in one of the class's superclasses. This option is required. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item * method |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
The subroutine reference which implements the overriding. This option |
99
|
|
|
|
|
|
|
is required. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=back |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 BUGS |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
See L<Moose/BUGS> for details on reporting bugs. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 AUTHORS |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=over 4 |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item * |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Stevan Little <stevan@cpan.org> |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item * |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
Jesse Luehrs <doy@cpan.org> |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item * |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Shawn M Moore <sartak@cpan.org> |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item * |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org> |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=item * |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Karen Etheridge <ether@cpan.org> |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=item * |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=item * |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Hans Dieter Pearcey <hdp@cpan.org> |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Chris Prather <chris@prather.org> |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item * |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Matt S Trout <mstrout@cpan.org> |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=back |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
This software is copyright (c) 2006 by Infinity Interactive, Inc. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
158
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=cut |