line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Moose::Meta::Method::Overridden; |
2
|
|
|
|
|
|
|
our $VERSION = '2.2206'; |
3
|
|
|
|
|
|
|
|
4
|
380
|
|
|
8459
|
|
2797
|
use strict; |
|
380
|
|
|
|
|
878
|
|
|
380
|
|
|
|
|
11356
|
|
5
|
380
|
|
|
8303
|
|
3281
|
use warnings; |
|
380
|
|
|
|
|
934
|
|
|
380
|
|
|
|
|
10925
|
|
6
|
|
|
|
|
|
|
|
7
|
380
|
|
|
6191
|
|
2317
|
use parent 'Moose::Meta::Method'; |
|
380
|
|
|
|
|
952
|
|
|
380
|
|
|
|
|
7496
|
|
8
|
|
|
|
|
|
|
|
9
|
380
|
|
|
6149
|
|
29546
|
use Moose::Util 'throw_exception'; |
|
380
|
|
|
|
|
1019
|
|
|
380
|
|
|
|
|
2827
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
1010
|
|
|
6779
|
1
|
4329
|
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
|
1010
|
|
66
|
|
|
3155
|
my $super_package = $args{package} || $args{class}->name; |
19
|
|
|
|
|
|
|
|
20
|
1010
|
|
|
|
|
1978
|
my $name = $args{name}; |
21
|
|
|
|
|
|
|
|
22
|
1010
|
|
|
|
|
3571
|
my $super = $args{class}->find_next_method_by_name($name); |
23
|
|
|
|
|
|
|
|
24
|
1010
|
100
|
|
|
|
2731
|
(defined $super) |
25
|
|
|
|
|
|
|
|| throw_exception( CannotOverrideNoSuperMethod => class => $class, |
26
|
|
|
|
|
|
|
params => \%args, |
27
|
|
|
|
|
|
|
method_name => $name |
28
|
|
|
|
|
|
|
); |
29
|
|
|
|
|
|
|
|
30
|
1008
|
|
|
|
|
3229
|
my $super_body = $super->body; |
31
|
|
|
|
|
|
|
|
32
|
1008
|
|
|
|
|
2272
|
my $method = $args{method}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $body = sub { |
35
|
2421
|
|
|
7660
|
|
19557
|
local $Moose::SUPER_PACKAGE = $super_package; |
|
|
|
|
5692
|
|
|
|
|
|
|
|
5842
|
|
|
|
|
|
|
|
8071
|
|
|
|
|
|
|
|
7704
|
|
|
|
|
|
|
|
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
|
2421
|
|
|
|
|
6878
|
local @Moose::SUPER_ARGS = @_; |
37
|
2421
|
|
|
|
|
4439
|
local $Moose::SUPER_BODY = $super_body; |
38
|
2421
|
|
|
|
|
7146
|
return $method->(@_); |
39
|
1008
|
|
|
|
|
5266
|
}; |
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
|
1008
|
|
|
|
|
4761
|
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.2206 |
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 |