line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::Declare::Syntax::Extending; |
2
|
|
|
|
|
|
|
# ABSTRACT: Extending with superclasses |
3
|
|
|
|
|
|
|
$MooseX::Declare::Syntax::Extending::VERSION = '0.40'; |
4
|
24
|
|
|
24
|
|
11464
|
use Moose::Role; |
|
24
|
|
|
|
|
47
|
|
|
24
|
|
|
|
|
152
|
|
5
|
|
|
|
|
|
|
|
6
|
24
|
|
|
24
|
|
93546
|
use aliased 'MooseX::Declare::Context::Namespaced'; |
|
24
|
|
|
|
|
52
|
|
|
24
|
|
|
|
|
165
|
|
7
|
|
|
|
|
|
|
|
8
|
24
|
|
|
24
|
|
3857
|
use namespace::clean -except => 'meta'; |
|
24
|
|
|
|
|
39
|
|
|
24
|
|
|
|
|
181
|
|
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
|
15
|
my ($self, $ctx, $package, $superclasses) = @_; |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
# add code for extends keyword |
45
|
8
|
|
|
|
|
371
|
$ctx->add_scope_code_parts( |
46
|
|
|
|
|
|
|
sprintf 'extends %s', |
47
|
|
|
|
|
|
|
join ', ', |
48
|
8
|
|
|
|
|
30
|
map { "'$_'" } |
49
|
8
|
|
|
|
|
15
|
map { $ctx->qualify_namespace($_) } |
50
|
8
|
|
|
|
|
22
|
@{ $superclasses }, |
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.40 |
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 |