line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::Declare::Syntax::Extending; |
2
|
|
|
|
|
|
|
# ABSTRACT: Extending with superclasses |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
our $VERSION = '0.43'; |
5
|
|
|
|
|
|
|
|
6
|
24
|
|
|
24
|
|
11662
|
use Moose::Role; |
|
24
|
|
|
|
|
38
|
|
|
24
|
|
|
|
|
143
|
|
7
|
24
|
|
|
24
|
|
83464
|
use aliased 'MooseX::Declare::Context::Namespaced'; |
|
24
|
|
|
|
|
45
|
|
|
24
|
|
|
|
|
146
|
|
8
|
24
|
|
|
24
|
|
3441
|
use namespace::autoclean; |
|
24
|
|
|
|
|
35
|
|
|
24
|
|
|
|
|
165
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
11
|
|
|
|
|
|
|
#pod |
12
|
|
|
|
|
|
|
#pod Extends a class by a specified C<extends> option. |
13
|
|
|
|
|
|
|
#pod |
14
|
|
|
|
|
|
|
#pod =head1 CONSUMES |
15
|
|
|
|
|
|
|
#pod |
16
|
|
|
|
|
|
|
#pod =for :list |
17
|
|
|
|
|
|
|
#pod * L<MooseX::Declare::Syntax::OptionHandling> |
18
|
|
|
|
|
|
|
#pod |
19
|
|
|
|
|
|
|
#pod =cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
with qw( |
22
|
|
|
|
|
|
|
MooseX::Declare::Syntax::OptionHandling |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
around context_traits => sub { shift->(@_), Namespaced }; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#pod =method add_extends_option_customizations |
28
|
|
|
|
|
|
|
#pod |
29
|
|
|
|
|
|
|
#pod Object->add_extends_option_customizations ( |
30
|
|
|
|
|
|
|
#pod Object $ctx, |
31
|
|
|
|
|
|
|
#pod Str $package, |
32
|
|
|
|
|
|
|
#pod ArrayRef $superclasses, |
33
|
|
|
|
|
|
|
#pod HashRef $options |
34
|
|
|
|
|
|
|
#pod ) |
35
|
|
|
|
|
|
|
#pod |
36
|
|
|
|
|
|
|
#pod This will add a code part that will call C<extends> with the C<$superclasses> |
37
|
|
|
|
|
|
|
#pod as arguments. |
38
|
|
|
|
|
|
|
#pod |
39
|
|
|
|
|
|
|
#pod =cut |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub add_extends_option_customizations { |
42
|
8
|
|
|
8
|
1
|
18
|
my ($self, $ctx, $package, $superclasses) = @_; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# add code for extends keyword |
45
|
|
|
|
|
|
|
$ctx->add_scope_code_parts( |
46
|
|
|
|
|
|
|
sprintf 'extends %s', |
47
|
|
|
|
|
|
|
join ', ', |
48
|
8
|
|
|
|
|
394
|
map { "'$_'" } |
49
|
8
|
|
|
|
|
34
|
map { $ctx->qualify_namespace($_) } |
50
|
8
|
|
|
|
|
18
|
@{ $superclasses }, |
|
8
|
|
|
|
|
18
|
|
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
|
53
|
8
|
|
|
|
|
25
|
return 1; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
57
|
|
|
|
|
|
|
#pod |
58
|
|
|
|
|
|
|
#pod =for :list |
59
|
|
|
|
|
|
|
#pod * L<MooseX::Declare> |
60
|
|
|
|
|
|
|
#pod * L<MooseX::Declare::Syntax::Keyword::Class> |
61
|
|
|
|
|
|
|
#pod * L<MooseX::Declare::Syntax::OptionHandling> |
62
|
|
|
|
|
|
|
#pod |
63
|
|
|
|
|
|
|
#pod =cut |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=pod |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=encoding UTF-8 |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 NAME |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
MooseX::Declare::Syntax::Extending - Extending with superclasses |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 VERSION |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
version 0.43 |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 DESCRIPTION |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Extends a class by a specified C<extends> option. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 METHODS |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head2 add_extends_option_customizations |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
Object->add_extends_option_customizations ( |
90
|
|
|
|
|
|
|
Object $ctx, |
91
|
|
|
|
|
|
|
Str $package, |
92
|
|
|
|
|
|
|
ArrayRef $superclasses, |
93
|
|
|
|
|
|
|
HashRef $options |
94
|
|
|
|
|
|
|
) |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This will add a code part that will call C<extends> with the C<$superclasses> |
97
|
|
|
|
|
|
|
as arguments. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 CONSUMES |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=over 4 |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item * |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
L<MooseX::Declare::Syntax::OptionHandling> |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=back |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 SEE ALSO |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=over 4 |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item * |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
L<MooseX::Declare> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item * |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
L<MooseX::Declare::Syntax::Keyword::Class> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item * |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
L<MooseX::Declare::Syntax::OptionHandling> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=back |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 AUTHOR |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
This software is copyright (c) 2008 by Florian Ragwitz. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
136
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=cut |