line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::Declare::Syntax::Keyword::Clean; |
2
|
|
|
|
|
|
|
# ABSTRACT: Explicit namespace cleanups |
3
|
|
|
|
|
|
|
$MooseX::Declare::Syntax::Keyword::Clean::VERSION = '0.40'; |
4
|
24
|
|
|
24
|
|
12449
|
use Moose; |
|
24
|
|
|
|
|
45
|
|
|
24
|
|
|
|
|
147
|
|
5
|
|
|
|
|
|
|
|
6
|
24
|
|
|
24
|
|
115546
|
use constant NAMESPACING_ROLE => 'MooseX::Declare::Syntax::NamespaceHandling'; |
|
24
|
|
|
|
|
43
|
|
|
24
|
|
|
|
|
1659
|
|
7
|
24
|
|
|
24
|
|
112
|
use Carp qw( cluck ); |
|
24
|
|
|
|
|
31
|
|
|
24
|
|
|
|
|
1381
|
|
8
|
|
|
|
|
|
|
|
9
|
24
|
|
|
24
|
|
115
|
use namespace::clean -except => 'meta'; |
|
24
|
|
|
|
|
35
|
|
|
24
|
|
|
|
|
190
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#pod =head1 DESCRIPTION |
12
|
|
|
|
|
|
|
#pod |
13
|
|
|
|
|
|
|
#pod This keyword will inject a call to L<namespace::clean> into its current |
14
|
|
|
|
|
|
|
#pod position. |
15
|
|
|
|
|
|
|
#pod |
16
|
|
|
|
|
|
|
#pod =head1 CONSUMES |
17
|
|
|
|
|
|
|
#pod |
18
|
|
|
|
|
|
|
#pod =for :list |
19
|
|
|
|
|
|
|
#pod * L<MooseX::Declare::Syntax::KeywordHandling> |
20
|
|
|
|
|
|
|
#pod |
21
|
|
|
|
|
|
|
#pod =cut |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
with qw( |
24
|
|
|
|
|
|
|
MooseX::Declare::Syntax::KeywordHandling |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub find_namespace_handler { |
28
|
3
|
|
|
3
|
0
|
6
|
my ($self, $ctx) = @_; |
29
|
|
|
|
|
|
|
|
30
|
3
|
|
|
|
|
6
|
for my $item (reverse @{ $ctx->stack }) { |
|
3
|
|
|
|
|
86
|
|
31
|
3
|
50
|
|
|
|
101
|
return $item |
32
|
|
|
|
|
|
|
if $item->handler->does(NAMESPACING_ROLE); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
return undef; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#pod =method parse |
39
|
|
|
|
|
|
|
#pod |
40
|
|
|
|
|
|
|
#pod Object->parse(Object $context) |
41
|
|
|
|
|
|
|
#pod |
42
|
|
|
|
|
|
|
#pod This will inject a call to L<namespace::clean> C<< -except => 'meta' >> into |
43
|
|
|
|
|
|
|
#pod the code at the position of the keyword. |
44
|
|
|
|
|
|
|
#pod |
45
|
|
|
|
|
|
|
#pod =cut |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub parse { |
48
|
3
|
|
|
3
|
1
|
6
|
my ($self, $ctx) = @_; |
49
|
|
|
|
|
|
|
|
50
|
3
|
50
|
|
|
|
14
|
if (my $stack_item = $self->find_namespace_handler($ctx)) { |
51
|
3
|
|
|
|
|
96
|
my $namespace = $stack_item->namespace; |
52
|
|
|
|
|
|
|
|
53
|
3
|
100
|
|
|
|
103
|
cluck "Attempted to clean an already cleaned namespace ($namespace). Did you mean to use 'is dirty'?" |
54
|
|
|
|
|
|
|
unless $stack_item->is_dirty; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
3
|
|
|
|
|
230
|
$ctx->skip_declarator; |
58
|
3
|
|
|
|
|
119
|
$ctx->inject_code_parts_here( |
59
|
|
|
|
|
|
|
';use namespace::clean -except => [qw( meta )]', |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
64
|
|
|
|
|
|
|
#pod |
65
|
|
|
|
|
|
|
#pod =for :list |
66
|
|
|
|
|
|
|
#pod * L<MooseX::Declare> |
67
|
|
|
|
|
|
|
#pod * L<MooseX::Declare::Syntax::KeywordHandling> |
68
|
|
|
|
|
|
|
#pod |
69
|
|
|
|
|
|
|
#pod =cut |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
1; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=pod |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=encoding UTF-8 |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 NAME |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
MooseX::Declare::Syntax::Keyword::Clean - Explicit namespace cleanups |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 VERSION |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
version 0.40 |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 DESCRIPTION |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This keyword will inject a call to L<namespace::clean> into its current |
90
|
|
|
|
|
|
|
position. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 METHODS |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 parse |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Object->parse(Object $context) |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
This will inject a call to L<namespace::clean> C<< -except => 'meta' >> into |
99
|
|
|
|
|
|
|
the code at the position of the keyword. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 CONSUMES |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=over 4 |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item * |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
L<MooseX::Declare::Syntax::KeywordHandling> |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=back |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 SEE ALSO |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=over 4 |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
L<MooseX::Declare> |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item * |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L<MooseX::Declare::Syntax::KeywordHandling> |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=back |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 AUTHOR |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Florian Ragwitz <rafl@debian.org> |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This software is copyright (c) 2008 by Florian Ragwitz. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
134
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=cut |